Yabin Cui 952e9eb086 Don't use __thread in __cxa_thread_finalize().
Currently we use __thread variable to store thread_local_dtors,
which makes tsan test fork_atexit.cc hang. The problem is as below:
The main thread creates a worker thread, the worker thread calls
pthread_exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init) -> emutls_init().
Then the main thread calls fork(), the child process cals
exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init).
So the child process is waiting for pthread_once(emutls_init)
to finish which will never occur.

It might be the test's fault because POSIX standard says if a
multi-threaded process calls fork(), the new process may only
execute async-signal-safe operations until exec functions are
called. And exit() is not async-signal-safe. But we can make
bionic more reliable by not using __thread in
__cxa_thread_finalize().

Bug: 25392375
Change-Id: Ife403dd7379dad8ddf1859c348c1c0adea07afb3
2015-11-24 17:24:06 -08:00
..
2015-11-06 13:14:43 -08:00
2015-11-06 13:14:43 -08:00
2015-11-06 13:14:43 -08:00
2015-11-06 13:14:43 -08:00
2015-11-06 13:14:43 -08:00
2015-11-06 13:14:43 -08:00
2015-11-23 16:13:10 -08:00
2015-07-27 11:04:58 -07:00
2015-10-09 17:58:58 +01:00
2015-11-18 17:51:21 -08:00
2015-11-18 17:51:21 -08:00
2015-11-18 17:51:21 -08:00
2015-11-18 17:51:21 -08:00
2015-11-18 17:51:21 -08:00
2015-11-18 17:51:21 -08:00
2015-11-18 17:51:21 -08:00
2015-08-28 20:23:52 -07:00
2015-11-06 13:14:43 -08:00
2015-05-07 15:12:24 -07:00