Revert "Remove the global thread list."
This reverts commit b0e8c565a622b5519e03d4416b0b5b1a5f20d7f5.
Breaks swiftshader (http:/b/34883464).
Change-Id: I7b21193ba8a78f07d7ac65e41d0fe8516940a83b
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index 55a2e77..e5654c3 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -114,6 +114,10 @@
__check_max_thread_id();
#endif
+ // Get the main thread from TLS and add it to the thread list.
+ pthread_internal_t* main_thread = __get_thread();
+ __pthread_internal_add(main_thread);
+
// Register atfork handlers to take and release the arc4random lock.
pthread_atfork(arc4random_fork_handler, _thread_arc4_unlock, _thread_arc4_unlock);