Commit 90222d1a authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Rename object to handle in AtFork

Summary: [Folly] Rename `object` to `handle` in `AtFork` since it is used opaquely.

Reviewed By: luciang

Differential Revision: D19208246

fbshipit-source-id: 3fc23e85b64f911f8e172a22f7e7080952d4dfe9
parent 5edd05b5
...@@ -31,7 +31,7 @@ namespace detail { ...@@ -31,7 +31,7 @@ namespace detail {
namespace { namespace {
struct AtForkTask { struct AtForkTask {
void* object; void* handle;
folly::Function<bool()> prepare; folly::Function<bool()> prepare;
folly::Function<void()> parent; folly::Function<void()> parent;
folly::Function<void()> child; folly::Function<void()> child;
...@@ -115,23 +115,23 @@ void AtFork::init() { ...@@ -115,23 +115,23 @@ void AtFork::init() {
} }
void AtFork::registerHandler( void AtFork::registerHandler(
void* object, void* handle,
folly::Function<bool()> prepare, folly::Function<bool()> prepare,
folly::Function<void()> parent, folly::Function<void()> parent,
folly::Function<void()> child) { folly::Function<void()> child) {
std::lock_guard<std::mutex> lg(AtForkList::instance().tasksLock); std::lock_guard<std::mutex> lg(AtForkList::instance().tasksLock);
AtForkList::instance().tasks.push_back( AtForkList::instance().tasks.push_back(
{object, std::move(prepare), std::move(parent), std::move(child)}); {handle, std::move(prepare), std::move(parent), std::move(child)});
} }
void AtFork::unregisterHandler(void* object) { void AtFork::unregisterHandler(void* handle) {
if (!object) { if (!handle) {
return; return;
} }
auto& list = AtForkList::instance(); auto& list = AtForkList::instance();
std::lock_guard<std::mutex> lg(list.tasksLock); std::lock_guard<std::mutex> lg(list.tasksLock);
for (auto it = list.tasks.begin(); it != list.tasks.end(); ++it) { for (auto it = list.tasks.begin(); it != list.tasks.end(); ++it) {
if (it->object == object) { if (it->handle == handle) {
list.tasks.erase(it); list.tasks.erase(it);
return; return;
} }
......
...@@ -25,11 +25,11 @@ namespace detail { ...@@ -25,11 +25,11 @@ namespace detail {
struct AtFork { struct AtFork {
static void init(); static void init();
static void registerHandler( static void registerHandler(
void* object, void* handle,
folly::Function<bool()> prepare, folly::Function<bool()> prepare,
folly::Function<void()> parent, folly::Function<void()> parent,
folly::Function<void()> child); folly::Function<void()> child);
static void unregisterHandler(void* object); static void unregisterHandler(void* handle);
}; };
} // namespace detail } // namespace detail
......
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