summaryrefslogtreecommitdiffstats
path: root/include/utils
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-02-02 13:24:52 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-02 13:24:52 -0800
commita1eee39f581249ae137ce3cb372fbf92ed1344bf (patch)
tree52212339c9add461d371b255e543edccfe943556 /include/utils
parent6815727eb7a8f9da4f9473964581d2ee3ce8b3e3 (diff)
parentba699cb0f7f95f665593541d2b37e12fb10b85f1 (diff)
downloadframeworks_native-a1eee39f581249ae137ce3cb372fbf92ed1344bf.zip
frameworks_native-a1eee39f581249ae137ce3cb372fbf92ed1344bf.tar.gz
frameworks_native-a1eee39f581249ae137ce3cb372fbf92ed1344bf.tar.bz2
Merge "Thread::getTid returns pid_t gettid() after run"
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/threads.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/utils/threads.h b/include/utils/threads.h
index ab3e8cd..b4a8b7c 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -526,6 +526,12 @@ public:
// Do not call from this object's thread; will return WOULD_BLOCK in that case.
status_t join();
+#ifdef HAVE_ANDROID_OS
+ // Return the thread's kernel ID, same as the thread itself calling gettid() or
+ // androidGetTid(), or -1 if the thread is not running.
+ pid_t getTid() const;
+#endif
+
protected:
// exitPending() returns true if requestExit() has been called.
bool exitPending() const;
@@ -551,8 +557,10 @@ private:
volatile bool mExitPending;
volatile bool mRunning;
sp<Thread> mHoldSelf;
-#if HAVE_ANDROID_OS
- int mTid;
+#ifdef HAVE_ANDROID_OS
+ // legacy for debugging, not used by getTid() as it is set by the child thread
+ // and so is not initialized until the child reaches that point
+ pid_t mTid;
#endif
};