diff options
author | Ian Rogers <irogers@google.com> | 2013-09-06 13:10:04 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-09-09 08:33:36 -0700 |
commit | 02ed4c04468ca5f5540c5b704ac3e2f30eb9e8f4 (patch) | |
tree | fd568452f4ae81868087e9a5f6c04a9051d0ef83 /runtime/thread-inl.h | |
parent | 28c2300d9a85f4e7288fb5d94280332f923b4df3 (diff) | |
download | art-02ed4c04468ca5f5540c5b704ac3e2f30eb9e8f4.tar.gz art-02ed4c04468ca5f5540c5b704ac3e2f30eb9e8f4.tar.bz2 art-02ed4c04468ca5f5540c5b704ac3e2f30eb9e8f4.zip |
Move disassembler out of runtime.
Bug: 9877500.
Change-Id: Ica6d9f5ecfd20c86e5230a2213827bd78cd29a29
Diffstat (limited to 'runtime/thread-inl.h')
-rw-r--r-- | runtime/thread-inl.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h index c22f2cd921..4552062319 100644 --- a/runtime/thread-inl.h +++ b/runtime/thread-inl.h @@ -19,11 +19,24 @@ #include "thread.h" +#include <pthread.h> + #include "base/mutex-inl.h" #include "cutils/atomic-inline.h" namespace art { +inline Thread* Thread::Current() { + // We rely on Thread::Current returning NULL for a detached thread, so it's not obvious + // that we can replace this with a direct %fs access on x86. + if (!is_started_) { + return NULL; + } else { + void* thread = pthread_getspecific(Thread::pthread_key_self_); + return reinterpret_cast<Thread*>(thread); + } +} + inline ThreadState Thread::SetState(ThreadState new_state) { // Cannot use this code to change into Runnable as changing to Runnable should fail if // old_state_and_flags.suspend_request is true. |