Commit 2bf6f465 authored by Hans Fugal's avatar Hans Fugal Committed by Sara Golemon

apple-gate ThreadLocal in fibers code

Summary: Some internal malloc shims broke on using folly::ThreadLocal, so only do that for `__APPLE__`.

Reviewed By: @brianwatling

Differential Revision: D2151318
parent 3bb12827
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include <folly/Optional.h> #include <folly/Optional.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#ifdef __APPLE__
#include <folly/ThreadLocal.h> #include <folly/ThreadLocal.h>
#endif
#include <folly/experimental/fibers/Baton.h> #include <folly/experimental/fibers/Baton.h>
#include <folly/experimental/fibers/Fiber.h> #include <folly/experimental/fibers/Fiber.h>
#include <folly/experimental/fibers/LoopController.h> #include <folly/experimental/fibers/LoopController.h>
...@@ -455,8 +457,13 @@ T& FiberManager::local() { ...@@ -455,8 +457,13 @@ T& FiberManager::local() {
template <typename T> template <typename T>
T& FiberManager::localThread() { T& FiberManager::localThread() {
#ifndef __APPLE__
static thread_local T t;
return t;
#else // osx doesn't support thread_local
static ThreadLocal<T> t; static ThreadLocal<T> t;
return *t; return *t;
#endif
} }
inline void FiberManager::initLocalData(Fiber& fiber) { inline void FiberManager::initLocalData(Fiber& fiber) {
......
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