fix PTHREAD_ATFORK croaking too early, too often
Coral [Mon, 16 Jul 2001 14:25:19 +0000 (07:25 -0700)]
Message-Id:  <200107162125.f6GLPJ345261@moonlight.crystalflame.net>

p4raw-id: //depot/perl@11392

pp_sys.c
thread.h

index 0451d5a..6a74b11 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3874,6 +3874,10 @@ PP(pp_fork)
     Pid_t childpid;
     GV *tmpgv;
 
+#   if defined(USE_ITHREADS) && !defined(HAS_PTHREAD_ATFORK)
+       Perl_croak(aTHX_ "No pthread_atfork() -- fork() too unsafe");
+#   endif
+
     EXTEND(SP, 1);
     PERL_FLUSHALL_FOR_CHILD;
     childpid = fork();
index a82c01b..3b26b17 100644 (file)
--- a/thread.h
+++ b/thread.h
@@ -310,13 +310,8 @@ void Perl_atfork_unlock(void);
 #    define PTHREAD_ATFORK(prepare,parent,child)               \
        pthread_atfork(prepare,parent,child)
 #  else
-#    ifdef HAS_FORK
-#      define PTHREAD_ATFORK(prepare,parent,child)             \
-        Perl_croak(aTHX_ "No pthread_atfork() -- fork() too unsafe");
-#    else
-#      define PTHREAD_ATFORK(prepare,parent,child)             \
-        NOOP
-#    endif
+#    define PTHREAD_ATFORK(prepare,parent,child)               \
+       NOOP
 #  endif
 #endif
 
@@ -474,7 +469,3 @@ typedef struct condpair {
 #ifndef INIT_THREADS
 #  define INIT_THREADS NOOP
 #endif
-
-#ifndef PTHREAD_ATFORK
-#  define PTHREAD_ATFORK(prepare,parent,child) NOOP
-#endif