Revert "Remove the global thread list."
This reverts commit b0e8c565a622b5519e03d4416b0b5b1a5f20d7f5.
Breaks swiftshader (http:/b/34883464).
Change-Id: I7b21193ba8a78f07d7ac65e41d0fe8516940a83b
diff --git a/libc/bionic/pthread_kill.cpp b/libc/bionic/pthread_kill.cpp
index 03301f5..93513fa 100644
--- a/libc/bionic/pthread_kill.cpp
+++ b/libc/bionic/pthread_kill.cpp
@@ -37,6 +37,10 @@
int pthread_kill(pthread_t t, int sig) {
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;
+ }
+
return (tgkill(getpid(), thread->tid, sig) == -1) ? errno : 0;
}