Commit 8ea4ee70 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

simplify pthread_atfork detection in AtFork

Differential Revision: D34224951

fbshipit-source-id: f3f4fe2866c795a285382d59be07f5d7f0fb6cfa
parent 02d76dc2
...@@ -111,21 +111,15 @@ class AtForkList { ...@@ -111,21 +111,15 @@ class AtForkList {
private: private:
AtForkList() { AtForkList() {
#if FOLLY_HAVE_PTHREAD_ATFORK int ret = 0;
int ret = pthread_atfork( #if FOLLY_HAVE_PTHREAD_ATFORK // if no pthread_atfork, probably no fork either
ret = pthread_atfork(
&AtForkList::prepare, &AtForkList::parent, &AtForkList::child); &AtForkList::prepare, &AtForkList::parent, &AtForkList::child);
#endif
if (ret != 0) { if (ret != 0) {
throw_exception<std::system_error>( throw_exception<std::system_error>(
ret, std::generic_category(), "pthread_atfork failed"); ret, std::generic_category(), "pthread_atfork failed");
} }
#elif !__ANDROID__ && !defined(_MSC_VER)
// pthread_atfork is not part of the Android NDK at least as of n9d. If
// something is trying to call native fork() directly at all with Android's
// process management model, this is probably the least of the problems.
//
// But otherwise, this is a problem.
#warning pthread_atfork unavailable
#endif
} }
}; };
} // namespace } // namespace
......
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