am 708da446: Merge "Use gettid directly in frameworks JNI."
* commit '708da44695216b57a9389a74b95b4ef6f530120a': Use gettid directly in frameworks JNI.
This commit is contained in:
@@ -1036,16 +1036,9 @@ static void conditionally_log_binder_call(int64_t start_millis,
|
||||
}
|
||||
|
||||
// We only measure binder call durations to potentially log them if
|
||||
// we're on the main thread. Unfortunately sim-eng doesn't seem to
|
||||
// have gettid, so we just ignore this and don't log if we can't
|
||||
// get the thread id.
|
||||
// we're on the main thread.
|
||||
static bool should_time_binder_calls() {
|
||||
#ifdef HAVE_GETTID
|
||||
return (getpid() == androidGetTid());
|
||||
#else
|
||||
#warning no gettid(), so not logging Binder calls...
|
||||
return false;
|
||||
#endif
|
||||
return (getpid() == gettid());
|
||||
}
|
||||
|
||||
static jboolean android_os_BinderProxy_transact(JNIEnv* env, jobject obj,
|
||||
|
||||
@@ -268,7 +268,7 @@ static void android_os_Process_setCanSelfBackground(JNIEnv* env, jobject clazz,
|
||||
// Establishes the calling thread as illegal to put into the background.
|
||||
// Typically used only for the system process's main looper.
|
||||
#if GUARD_THREAD_PRIORITY
|
||||
ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, androidGetTid());
|
||||
ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, gettid());
|
||||
{
|
||||
Mutex::Autolock _l(gKeyCreateMutex);
|
||||
if (gBgKey == -1) {
|
||||
@@ -303,7 +303,7 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
|
||||
// if we're putting the current thread into the background, check the TLS
|
||||
// to make sure this thread isn't guarded. If it is, raise an exception.
|
||||
if (pri >= ANDROID_PRIORITY_BACKGROUND) {
|
||||
if (pid == androidGetTid()) {
|
||||
if (pid == gettid()) {
|
||||
void* bgOk = pthread_getspecific(gBgKey);
|
||||
if (bgOk == ((void*)0xbaad)) {
|
||||
ALOGE("Thread marked fg-only put self in background!");
|
||||
@@ -330,7 +330,7 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
|
||||
void android_os_Process_setCallingThreadPriority(JNIEnv* env, jobject clazz,
|
||||
jint pri)
|
||||
{
|
||||
android_os_Process_setThreadPriority(env, clazz, androidGetTid(), pri);
|
||||
android_os_Process_setThreadPriority(env, clazz, gettid(), pri);
|
||||
}
|
||||
|
||||
jint android_os_Process_getThreadPriority(JNIEnv* env, jobject clazz,
|
||||
|
||||
Reference in New Issue
Block a user