Handle platforms that don't support __thread.
authorPeter Griess <pgriess@fb.com>
Sat, 12 Oct 2013 11:11:59 +0000 (04:11 -0700)
committerPeter Griess <pgriess@fb.com>
Tue, 26 Nov 2013 15:05:18 +0000 (07:05 -0800)
commitea10c90474c682e76c4a147d96734704462f99dc
tree3ee501b5002a1117363a655079ba52b7363c3b1d
parenta0fe3c18976a67c4ebea16f986d86e98e9489706
Handle platforms that don't support __thread.

Summary:
- Apple platforms either have different __thread behavior than Linux: on
i386 __thread values are zeroed out before the destructor provided to
pthread_key_create(3) is called; on ARM, __thread isn't supported at
all. To handle this, use pthread_getspecific(3) to manage the array of
IDs on these platforms only.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: simpkins@fb.com

FB internal diff: D1008923
folly/ThreadLocal.h
folly/detail/ThreadLocalDetail.h