diff options
| author | Andy McFadden <fadden@android.com> | 2010-03-10 07:29:43 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2010-03-10 07:29:43 -0800 |
| commit | defadf4ddf1fa7f1bd4fd4938f3fdd6908e65dcc (patch) | |
| tree | eea88757fce9efaa3bc57b646f7824f2a11c2ec7 /vm/Thread.h | |
| parent | 2df6b60a302602424c23f6a183b66b507a186af7 (diff) | |
| parent | 77fbf5c29a9dd62f64e8e98376724b86e79ae8f6 (diff) | |
| download | android_dalvik-defadf4ddf1fa7f1bd4fd4938f3fdd6908e65dcc.tar.gz android_dalvik-defadf4ddf1fa7f1bd4fd4938f3fdd6908e65dcc.tar.bz2 android_dalvik-defadf4ddf1fa7f1bd4fd4938f3fdd6908e65dcc.zip | |
am 77fbf5c2: Merge "If a finalizer wedges, raise prio and retry."
Merge commit '77fbf5c29a9dd62f64e8e98376724b86e79ae8f6' into dalvik-dev
* commit '77fbf5c29a9dd62f64e8e98376724b86e79ae8f6':
If a finalizer wedges, raise prio and retry.
Diffstat (limited to 'vm/Thread.h')
| -rw-r--r-- | vm/Thread.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vm/Thread.h b/vm/Thread.h index ba9417a5a..44004bfd9 100644 --- a/vm/Thread.h +++ b/vm/Thread.h @@ -22,6 +22,9 @@ #include "jni.h" +#include <cutils/sched_policy.h> + + #if defined(CHECK_MUTEX) && !defined(__USE_UNIX98) /* glibc lacks this unless you #define __USE_UNIX98 */ int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); @@ -437,6 +440,14 @@ Object* dvmGetSystemThreadGroup(void); Thread* dvmGetThreadFromThreadObject(Object* vmThreadObj); /* + * Given a pthread handle, return the associated Thread*. + * Caller must NOT hold the thread list lock. + * + * Returns NULL if the thread was not found. + */ +Thread* dvmGetThreadByHandle(pthread_t handle); + +/* * Sleep in a thread. Returns when the sleep timer returns or the thread * is interrupted. */ @@ -469,6 +480,25 @@ INLINE void dvmSetThreadJNIEnv(Thread* self, JNIEnv* env) { self->jniEnv = env;} */ void dvmChangeThreadPriority(Thread* thread, int newPriority); +/* "change flags" values for raise/reset thread priority calls */ +#define kChangedPriority 0x01 +#define kChangedPolicy 0x02 + +/* + * If necessary, raise the thread's priority to nice=0 cgroup=fg. + * + * Returns bit flags indicating changes made (zero if nothing was done). + */ +int dvmRaiseThreadPriorityIfNeeded(Thread* thread, int* pSavedThreadPrio, + SchedPolicy* pSavedThreadPolicy); + +/* + * Drop the thread priority to what it was before an earlier call to + * dvmRaiseThreadPriorityIfNeeded(). + */ +void dvmResetThreadPriority(Thread* thread, int changeFlags, + int savedThreadPrio, SchedPolicy savedThreadPolicy); + /* * Debug: dump information about a single thread. */ |
