MCPcopy Create free account
hub / github.com/apache/arrow / BeforeFork

Method BeforeFork

cpp/src/arrow/util/atfork_internal.cc:76–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 }
75
76 void BeforeFork() {
77 // Lock the mutex and keep it locked until the end of AfterForkParent(),
78 // to avoid multiple concurrent forks and atforks.
79 mutex_.lock();
80
81 DCHECK(handlers_while_forking_.empty()); // AfterForkParent clears it
82
83 for (const auto& weak_handler : handlers_) {
84 if (auto handler = weak_handler.lock()) {
85 handlers_while_forking_.emplace_back(std::move(handler));
86 }
87 }
88
89 // XXX can the handler call RegisterAtFork()?
90 for (auto&& handler : handlers_while_forking_) {
91 if (handler.handler->before) {
92 handler.token = handler.handler->before();
93 }
94 }
95 }
96
97 void AfterForkParent() {
98 // The mutex was locked by BeforeFork()

Callers 1

GetAtForkStateFunction · 0.45

Calls 2

emplace_backMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected