Skip to content

Commit

Permalink
Merge "dalvik: use pthread_setname_np() to set the name of the curren…
Browse files Browse the repository at this point in the history
…t thread"
  • Loading branch information
fadden authored and Android Code Review committed Jun 22, 2010
2 parents 8ea8d24 + bcd88cc commit 8bb1230
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vm/Thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,6 @@ static bool createFakeRunFrame(Thread* thread)
*/
static void setThreadName(const char *threadName)
{
#if defined(HAVE_PRCTL)
int hasAt = 0;
int hasDot = 0;
const char *s = threadName;
Expand All @@ -1267,7 +1266,13 @@ static void setThreadName(const char *threadName)
} else {
s = threadName + len - 15;
}
#if defined(HAVE_PTHREAD_SETNAME_NP)
if (pthread_setname_np(pthread_self(), s) != 0)
LOGW("Unable to set the name of the current thread\n");
#elif defined(HAVE_PRCTL)
prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0);
#else
LOGD("Unable to set current thread's name: %s\n", s);
#endif
}

Expand Down

0 comments on commit 8bb1230

Please sign in to comment.