Move threadlocal_detail::Atfork to its own file
[folly.git] / folly / detail / ThreadLocalDetail.h
index 2f6f10e85739258f43f6b8d9ea74c733e211e0a7..ecf4e67d956006b9850fe67012dc36b61c1b0ca8 100644 (file)
@@ -33,6 +33,7 @@
 #include <folly/ScopeGuard.h>
 #include <folly/SharedMutex.h>
 #include <folly/container/Foreach.h>
+#include <folly/detail/AtFork.h>
 #include <folly/memory/Malloc.h>
 #include <folly/portability/PThread.h>
 
@@ -292,12 +293,6 @@ struct StaticMetaBase {
 
   ElementWrapper& getElement(EntryID* ent);
 
-  static void initAtFork();
-  static void registerAtFork(
-      folly::Function<void()> prepare,
-      folly::Function<void()> parent,
-      folly::Function<void()> child);
-
   uint32_t nextId_;
   std::vector<uint32_t> freeIds_;
   std::mutex lock_;
@@ -321,7 +316,7 @@ struct StaticMeta : StaticMetaBase {
       : StaticMetaBase(
             &StaticMeta::getThreadEntrySlow,
             std::is_same<AccessMode, AccessModeStrict>::value) {
-    registerAtFork(
+    detail::AtFork::registerHandler(
         /*prepare*/ &StaticMeta::preFork,
         /*parent*/ &StaticMeta::onForkParent,
         /*child*/ &StaticMeta::onForkChild);