Reverted commit D3755446
authorPhilip Pronin <philipp@fb.com>
Wed, 31 Aug 2016 12:10:43 +0000 (05:10 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 31 Aug 2016 12:23:28 +0000 (05:23 -0700)
commitf8908e5150b6c8cf23ddd795e683fc23134d887a
treee1976c60f983254ffdadacbc90e46ba185ff5aaa
parent8c3d0bc981bc08e159f6599bfbac5e3daec03dba
Reverted commit D3755446

Summary:
Move ThreadLocal object destruction to occur under the lock to avoid races.
This causes a few cascading changes - the Tag lock needs to be a recursive_mutex so
constructing a new object while destroying another st. Also, forking requires
a new mutex to avoid deadlocking on accessing a recursive_mutex across a fork()

Reviewed By: andriigrynenko

Differential Revision: D3755446

fbshipit-source-id: f1f1f92175eb39e77aaa2add6915e5c9bb68d0fb
folly/ThreadCachedInt.h
folly/ThreadLocal.h
folly/detail/ThreadLocalDetail.cpp
folly/detail/ThreadLocalDetail.h
folly/test/ThreadCachedIntTest.cpp