Commit 581f790c authored by Sean Cannella's avatar Sean Cannella Committed by dcsommer

Fix one missing conditional for Android

Summary:
pthread_atfork isn't defined in the Android NDK (and therefore is not actually supported even though it's in bionic/libc) so don't call it there.

Test Plan: compiled on Linux, Android

Reviewed By: meyering@fb.com

Subscribers: njormrod, shikong, kmdent, fma

FB internal diff: D1620584

Tasks: 5183325
parent 7cc48094
...@@ -193,10 +193,15 @@ struct StaticMeta { ...@@ -193,10 +193,15 @@ struct StaticMeta {
int ret = pthread_key_create(&pthreadKey_, &onThreadExit); int ret = pthread_key_create(&pthreadKey_, &onThreadExit);
checkPosixError(ret, "pthread_key_create failed"); checkPosixError(ret, "pthread_key_create failed");
// 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.
#if !__ANDROID__
ret = pthread_atfork(/*prepare*/ &StaticMeta::preFork, ret = pthread_atfork(/*prepare*/ &StaticMeta::preFork,
/*parent*/ &StaticMeta::onForkParent, /*parent*/ &StaticMeta::onForkParent,
/*child*/ &StaticMeta::onForkChild); /*child*/ &StaticMeta::onForkChild);
checkPosixError(ret, "pthread_atfork failed"); checkPosixError(ret, "pthread_atfork failed");
#endif
} }
~StaticMeta() { ~StaticMeta() {
LOG(FATAL) << "StaticMeta lives forever!"; LOG(FATAL) << "StaticMeta lives forever!";
......
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