summaryrefslogtreecommitdiffstats
path: root/include/utils
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-07-11 15:59:22 -0700
committerGlenn Kasten <gkasten@google.com>2012-01-17 09:38:23 -0800
commit06a864413f03627ba7671d1c19ae114e3afaad4b (patch)
tree80350aef406318d12c2f9c4971adc8c7cccd4188 /include/utils
parentc83a666fe6f808f99a88a34f3fe00ee16ed48fd9 (diff)
downloadframeworks_base-06a864413f03627ba7671d1c19ae114e3afaad4b.zip
frameworks_base-06a864413f03627ba7671d1c19ae114e3afaad4b.tar.gz
frameworks_base-06a864413f03627ba7671d1c19ae114e3afaad4b.tar.bz2
Thread::getTid returns pid_t gettid() after run
This is needed when the parent or any other thread besides the child needs access to the child's kernel tid. Change-Id: Ib148505913eb78314cfd76657c30d7b20663dffd
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
};