#include <folly/system/AtFork.h>
#include <stdexcept>
#include <system_error>
#include <folly/ScopeGuard.h>
#include <folly/lang/Exception.h>
#include <folly/portability/PThread.h>
#include <folly/synchronization/SanitizeThread.h>
namespace folly {
void AtForkList::prepare() noexcept { … }
void AtForkList::parent() noexcept { … }
void AtForkList::child() noexcept { … }
void AtForkList::append(
void const* handle,
Function<bool()> prepare,
Function<void()> parent,
Function<void()> child) { … }
void AtForkList::remove(void const* handle) { … }
bool AtForkList::contains(
void const* handle) { … }
namespace {
struct SkipAtForkHandlers { … };
thread_local bool SkipAtForkHandlers::value;
void invoke_pthread_atfork(
void (*prepare)(), void (*parent)(), void (*child)()) { … }
struct AtForkListSingleton { … };
}
void AtFork::init() { … }
void AtFork::registerHandler(
void const* handle,
Function<bool()> prepare,
Function<void()> parent,
Function<void()> child) { … }
void AtFork::unregisterHandler(void const* handle) { … }
pid_t AtFork::forkInstrumented(fork_t forkFn) { … }
bool AtFork::init_ = …;
}