Commit 4bfa2a85 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Minimize AtFork deps

Summary: [Folly] Minimize `AtFork` deps by using removing use of `checkPosixError`. The owning library is a bit heavyweight.

Reviewed By: simpkins

Differential Revision: D8109884

fbshipit-source-id: a0a41ff64fd44b843970ae30f8fdb8ff4ff22acd
parent 3384af41
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <folly/detail/AtFork.h> #include <folly/detail/AtFork.h>
#include <list> #include <list>
#include <mutex> #include <mutex>
#include <folly/Exception.h> #include <folly/lang/Exception.h>
#include <folly/portability/PThread.h>
namespace folly { namespace folly {
...@@ -83,7 +85,10 @@ class AtForkList { ...@@ -83,7 +85,10 @@ class AtForkList {
#if FOLLY_HAVE_PTHREAD_ATFORK #if FOLLY_HAVE_PTHREAD_ATFORK
int ret = pthread_atfork( int ret = pthread_atfork(
&AtForkList::prepare, &AtForkList::parent, &AtForkList::child); &AtForkList::prepare, &AtForkList::parent, &AtForkList::child);
checkPosixError(ret, "pthread_atfork failed"); if (ret != 0) {
throw_exception<std::system_error>(
ret, std::generic_category(), "pthread_atfork failed");
}
#elif !__ANDROID__ && !defined(_MSC_VER) #elif !__ANDROID__ && !defined(_MSC_VER)
// pthread_atfork is not part of the Android NDK at least as of n9d. If // 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 // something is trying to call native fork() directly at all with Android's
......
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