summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-07 01:10:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-07 01:10:43 +0000
commite81a0d8f36d4245cf10fa5f47c980b96014fa0ae (patch)
tree59736128c050e5cd3ae734f5696a3b4c85299d45 /configure.in
parent11a8187bd16061f097396b0165c32dfc11297a7d (diff)
process.c: vfork may not work with pthread
* process.c (retry_fork_async_signal_safe): vfork may not work with pthread always even if fork works with it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in20
1 files changed, 13 insertions, 7 deletions
diff --git a/configure.in b/configure.in
index 97fff7c0a5..3c04d41c59 100644
--- a/configure.in
+++ b/configure.in
@@ -2669,9 +2669,11 @@ if test x"$ac_cv_header_ucontext_h" = xyes; then
fi
fi
-if test "$ac_cv_func_fork_works" = "yes" -a "$rb_with_pthread" = "yes"; then
- AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
- [AC_TRY_RUN([
+if test "$rb_with_pthread" = "yes"; then
+ for f in fork vfork; do
+ if eval 'test "$ac_cv_func_'$f'_works" = "yes"'; then
+ AC_CACHE_CHECK([if $f works with pthread], rb_cv_${f}_with_pthread,
+ [AC_TRY_RUN([
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
@@ -2710,7 +2712,7 @@ main(int argc, char *argv[])
{
pid_t pid;
if (use_threads()) return EXIT_FAILURE;
- pid = fork();
+ pid = $f();
if (pid) {
int loc;
@@ -2728,10 +2730,14 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}],
- rb_cv_fork_with_pthread=yes,
- rb_cv_fork_with_pthread=no,
- rb_cv_fork_with_pthread=yes)])
+ work=yes,
+ work=no,
+ work=yes)]
+ eval rb_cv_${f}_with_pthread=$work)
+ fi
+ done
test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
+ test x$rb_cv_vfork_with_pthread = xyes || AC_DEFINE(CANNOT_VFORK_WITH_PTHREAD)
fi