Commit b55e6225 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Fix broken Android build

Summary:
Fix broken Android build

(Note: this ignores all push blocking failures!)

Reviewed By: michalgr

Differential Revision: D7606076

fbshipit-source-id: 0cf0426a34cf62b045acb932d42a8e4a3cd5da71
parent 9210a201
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <folly/detail/ThreadLocalDetail.h> #include <folly/detail/ThreadLocalDetail.h>
#include <folly/synchronization/CallOnce.h>
#include <list> #include <list>
#include <mutex> #include <mutex>
...@@ -33,18 +34,13 @@ ThreadEntryList* StaticMetaBase::getThreadEntryList() { ...@@ -33,18 +34,13 @@ ThreadEntryList* StaticMetaBase::getThreadEntryList() {
static FOLLY_TLS ThreadEntryList threadEntryListSingleton; static FOLLY_TLS ThreadEntryList threadEntryListSingleton;
return &threadEntryListSingleton; return &threadEntryListSingleton;
#else #else
static bool init = false;
static std::mutex lock;
static pthread_key_t pthreadKey; static pthread_key_t pthreadKey;
static folly::once_flag onceFlag;
{ folly::call_once(onceFlag, [&]() {
std::lock_guard<std::mutex> guard(lock); int ret = pthread_key_create(&pthreadKey, nullptr);
if (!init) { checkPosixError(ret, "pthread_key_create failed");
int ret = pthread_key_create(&pthreadKey, nullptr); PthreadKeyUnregister::registerKey(pthreadKey);
checkPosixError(ret, "pthread_key_create failed"); });
PthreadKeyUnregister::registerKey(pthreadKey);
}
}
ThreadEntryList* threadEntryList = ThreadEntryList* threadEntryList =
static_cast<ThreadEntryList*>(pthread_getspecific(pthreadKey)); static_cast<ThreadEntryList*>(pthread_getspecific(pthreadKey));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment