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 @@
* limitations under the License.
*/
#include <folly/detail/ThreadLocalDetail.h>
#include <folly/synchronization/CallOnce.h>
#include <list>
#include <mutex>
......@@ -33,18 +34,13 @@ ThreadEntryList* StaticMetaBase::getThreadEntryList() {
static FOLLY_TLS ThreadEntryList threadEntryListSingleton;
return &threadEntryListSingleton;
#else
static bool init = false;
static std::mutex lock;
static pthread_key_t pthreadKey;
{
std::lock_guard<std::mutex> guard(lock);
if (!init) {
static folly::once_flag onceFlag;
folly::call_once(onceFlag, [&]() {
int ret = pthread_key_create(&pthreadKey, nullptr);
checkPosixError(ret, "pthread_key_create failed");
PthreadKeyUnregister::registerKey(pthreadKey);
}
}
});
ThreadEntryList* threadEntryList =
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