From 8ff9412f9ef1dbdabee4f0993653e1446d7a88c8 Mon Sep 17 00:00:00 2001 From: Coral Date: Mon, 16 Jul 2001 07:25:19 -0700 Subject: [PATCH] fix PTHREAD_ATFORK croaking too early, too often Message-Id: <200107162125.f6GLPJ345261@moonlight.crystalflame.net> p4raw-id: //depot/perl@11392 --- pp_sys.c | 4 ++++ thread.h | 13 ++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/pp_sys.c b/pp_sys.c index 0451d5a..6a74b11 100644 --- 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(); diff --git a/thread.h b/thread.h index a82c01b..3b26b17 100644 --- 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 -- 2.7.4