proxygen
folly::detail::AtFork Struct Reference

#include <AtFork.h>

Static Public Member Functions

static void init ()
 
static void registerHandler (void *object, folly::Function< bool()> prepare, folly::Function< void()> parent, folly::Function< void()> child)
 
static void unregisterHandler (void *object)
 

Detailed Description

Definition at line 24 of file AtFork.h.

Member Function Documentation

void folly::detail::AtFork::init ( )
static

Definition at line 104 of file AtFork.cpp.

104  {
105  AtForkList::instance();
106 }
void folly::detail::AtFork::registerHandler ( void *  object,
folly::Function< bool()>  prepare,
folly::Function< void()>  parent,
folly::Function< void()>  child 
)
static

Definition at line 108 of file AtFork.cpp.

References child, folly::gen::move, object, parent, prepare, and tasksLock.

Referenced by folly::AsyncFileWriter::AsyncFileWriter(), folly::rcu_domain< Tag >::rcu_domain(), folly::threadlocal_detail::StaticMeta< Tag, AccessMode >::StaticMeta(), and TEST().

112  {
113  std::lock_guard<std::mutex> lg(AtForkList::instance().tasksLock);
114  AtForkList::instance().tasks.push_back(
115  {object, std::move(prepare), std::move(parent), std::move(child)});
116 }
void * object
Definition: AtFork.cpp:32
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::mutex tasksLock
Definition: AtFork.cpp:80
void folly::detail::AtFork::unregisterHandler ( void *  object)
static

Definition at line 118 of file AtFork.cpp.

References bm::list.

Referenced by TEST(), folly::AsyncFileWriter::~AsyncFileWriter(), and folly::rcu_domain< Tag >::~rcu_domain().

118  {
119  auto& list = AtForkList::instance();
120  std::lock_guard<std::mutex> lg(list.tasksLock);
121  for (auto it = list.tasks.begin(); it != list.tasks.end(); ++it) {
122  if (it->object == object) {
123  list.tasks.erase(it);
124  return;
125  }
126  }
127 }
Encoder::MutableCompressedList list

The documentation for this struct was generated from the following files: