diff options
Diffstat (limited to 'src/static_vars.cc')
-rw-r--r-- | src/static_vars.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/static_vars.cc b/src/static_vars.cc index 09d2b59..79de97e 100644 --- a/src/static_vars.cc +++ b/src/static_vars.cc @@ -43,6 +43,7 @@ #include "sampler.h" // for Sampler #include "getenv_safe.h" // TCMallocGetenvSafe #include "base/googleinit.h" +#include "maybe_threads.h" namespace tcmalloc { @@ -107,16 +108,15 @@ void Static::InitStaticVars() { } -#if defined(HAVE_FORK) && defined(HAVE_PTHREAD) +#if defined(HAVE_FORK) && defined(HAVE_PTHREAD) && !defined(__APPLE__) static inline void SetupAtForkLocksHandler() { -#if !defined(__APPLE__) - pthread_atfork(CentralCacheLockAll, // parent calls before fork - CentralCacheUnlockAll, // parent calls after fork - CentralCacheUnlockAll); // child calls after fork -#endif + perftools_pthread_atfork( + CentralCacheLockAll, // parent calls before fork + CentralCacheUnlockAll, // parent calls after fork + CentralCacheUnlockAll); // child calls after fork } REGISTER_MODULE_INITIALIZER(tcmalloc_fork_handler, SetupAtForkLocksHandler()); |