OSDN Git Service

sigchain: switch from __thread to pthread_setspecific.
authorJosh Gao <jmgao@google.com>
Mon, 17 Apr 2017 22:58:36 +0000 (15:58 -0700)
committerJosh Gao <jmgao@google.com>
Mon, 17 Apr 2017 23:16:21 +0000 (16:16 -0700)
commit99875e9e6b5604cc8a970977d0f531a5035ad55c
tree395ced462bcd58e0cc6f49892cbb98a1678c0791
parente008fd53bf6b3f9b67adadcc469c9da8482585dc
sigchain: switch from __thread to pthread_setspecific.

__thread is implemented via emutls on Android, which will result in the
thread local variable being allocated again and leaked if it gets used
after it has been destructed already (e.g. by a later destructor
calling sigprocmask, or triggering a signal handler).

Switch to pthread_setspecific, which doesn't suffer from this problem.

Bug: http://b/36871013
Test: ran dalvikvm on a class that spins creating threads
Change-Id: Ie5deab453be387490ba30a0010e12f60d736c8ad
sigchainlib/sigchain.cc