diff options
| author | Elliott Hughes <enh@google.com> | 2017-02-07 21:05:30 +0000 |
|---|---|---|
| committer | Elliott Hughes <enh@google.com> | 2017-02-07 21:05:30 +0000 |
| commit | bcb152903a26269e2c8ada3b27c787ae875f8812 (patch) | |
| tree | 7bd88d5a8cde6ac54c1af51a11f5932988ce9215 /libc/bionic/pthread_getcpuclockid.cpp | |
| parent | f5a4992b7186c01b98cb9400b2b5b490805a87bb (diff) | |
Revert "Stop checking the global thread list in several trivial cases."
This reverts commit f5a4992b7186c01b98cb9400b2b5b490805a87bb.
Breaks OMX_ImgEnc in cameraserver (http://b/35088254).
Change-Id: I6dcf12706a184b0b8b72451584567a42dfa1bb4f
Diffstat (limited to 'libc/bionic/pthread_getcpuclockid.cpp')
| -rw-r--r-- | libc/bionic/pthread_getcpuclockid.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libc/bionic/pthread_getcpuclockid.cpp b/libc/bionic/pthread_getcpuclockid.cpp index dbfb7d455..2bf200480 100644 --- a/libc/bionic/pthread_getcpuclockid.cpp +++ b/libc/bionic/pthread_getcpuclockid.cpp @@ -31,11 +31,13 @@ #include "pthread_internal.h" int pthread_getcpuclockid(pthread_t t, clockid_t* clockid) { - pid_t tid = reinterpret_cast<pthread_internal_t*>(t)->tid; - if (tid == 0) return ESRCH; + pthread_internal_t* thread = __pthread_internal_find(t); + if (thread == NULL) { + return ESRCH; + } // The tid is stored in the top bits, but negated. - clockid_t result = ~static_cast<clockid_t>(tid) << 3; + clockid_t result = ~static_cast<clockid_t>(thread->tid) << 3; // Bits 0 and 1: clock type (0 = CPUCLOCK_PROF, 1 = CPUCLOCK_VIRT, 2 = CPUCLOCK_SCHED). result |= 2; // Bit 2: thread (set) or process (clear)? |
