Allow compiling grpc without use of pthread_atfork

pull/13573/head
Alexander Polcyn 7 years ago
parent 17a1431a37
commit d4a3bb817d
  1. 1
      setup.py
  2. 2
      src/core/lib/iomgr/fork_posix.cc

@ -181,6 +181,7 @@ if "linux" in sys.platform or "darwin" in sys.platform:
pymodinit_type = 'PyObject*' if PY3 else 'void'
pymodinit = '__attribute__((visibility ("default"))) {}'.format(pymodinit_type)
DEFINE_MACROS += (('PyMODINIT_FUNC', pymodinit),)
DEFINE_MACROS += (('GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK', 1),)
# By default, Python3 distutils enforces compatibility of
# c plugins (.so files) with the OSX version Python3 was built with.

@ -81,7 +81,9 @@ void grpc_postfork_child() {
void grpc_fork_handlers_auto_register() {
if (grpc_fork_support_enabled()) {
#ifdef GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK
pthread_atfork(grpc_prefork, grpc_postfork_parent, grpc_postfork_child);
#endif // GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK
}
}

Loading…
Cancel
Save