Revert "Remove the global thread list."
This reverts commit b0e8c565a622b5519e03d4416b0b5b1a5f20d7f5.
Breaks swiftshader (http:/b/34883464).
Change-Id: I7b21193ba8a78f07d7ac65e41d0fe8516940a83b
diff --git a/libc/bionic/pthread_getschedparam.cpp b/libc/bionic/pthread_getschedparam.cpp
index 39d098b..052fb05 100644
--- a/libc/bionic/pthread_getschedparam.cpp
+++ b/libc/bionic/pthread_getschedparam.cpp
@@ -34,7 +34,10 @@
int pthread_getschedparam(pthread_t t, int* policy, sched_param* param) {
ErrnoRestorer errno_restorer;
- pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(t);
+ pthread_internal_t* thread = __pthread_internal_find(t);
+ if (thread == NULL) {
+ return ESRCH;
+ }
int rc = sched_getparam(thread->tid, param);
if (rc == -1) {