diff options
author | William Roberts <wroberts@tresys.com> | 2013-10-29 15:19:22 -0700 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-01-17 00:19:50 -0800 |
commit | 258f631e86c4a78888ff49719e3eb9eaeb1ed835 (patch) | |
tree | 91f4361d88402204c8060badb46ac0cac93b0628 /vm/Thread.cpp | |
parent | 9e32e7e27c85d4a2e4781e24fe97c02d2d623ade (diff) | |
download | android_dalvik-258f631e86c4a78888ff49719e3eb9eaeb1ed835.tar.gz android_dalvik-258f631e86c4a78888ff49719e3eb9eaeb1ed835.tar.bz2 android_dalvik-258f631e86c4a78888ff49719e3eb9eaeb1ed835.zip |
export setThreadName() and add NULL check
Change-Id: I9b69a23b308fe851ed49722c0da3953433b3f5b8
Diffstat (limited to 'vm/Thread.cpp')
-rw-r--r-- | vm/Thread.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vm/Thread.cpp b/vm/Thread.cpp index 1ebfca74c..c3d944b0c 100644 --- a/vm/Thread.cpp +++ b/vm/Thread.cpp @@ -1179,11 +1179,17 @@ static bool createFakeRunFrame(Thread* thread) /* * Helper function to set the name of the current thread */ -static void setThreadName(const char *threadName) +void dvmSetThreadName(const char *threadName) { int hasAt = 0; int hasDot = 0; const char *s = threadName; + + if (s == NULL) { + ALOGW("Unable to set the name of current thread to NULL"); + return; + } + while (*s) { if (*s == '.') hasDot = 1; else if (*s == '@') hasAt = 1; @@ -1462,7 +1468,7 @@ static void* interpThreadStart(void* arg) Thread* self = (Thread*) arg; std::string threadName(dvmGetThreadName(self)); - setThreadName(threadName.c_str()); + dvmSetThreadName(threadName.c_str()); /* * Finish initializing the Thread struct. @@ -1724,7 +1730,7 @@ static void* internalThreadStart(void* arg) jniArgs.name = pArgs->name; jniArgs.group = reinterpret_cast<jobject>(pArgs->group); - setThreadName(pArgs->name); + dvmSetThreadName(pArgs->name); /* use local jniArgs as stack top */ if (dvmAttachCurrentThread(&jniArgs, pArgs->isDaemon)) { |