From: Doug MacEachern Date: Wed, 11 Jul 2001 08:59:12 +0000 (-0700) Subject: [patch] pthread_atfork bandaid X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=98e467d963acee4d1a7866eb7e9dd6c64605b460;p=p5sagit%2Fp5-mst-13.2.git [patch] pthread_atfork bandaid Message-ID: p4raw-id: //depot/perl@11281 --- diff --git a/miniperlmain.c b/miniperlmain.c index ed28f47..620fed7 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -48,6 +48,12 @@ main(int argc, char **argv, char **env) PERL_SYS_INIT3(&argc,&argv,&env); +#ifdef USE_ITHREADS + PTHREAD_ATFORK(Perl_atfork_lock, + Perl_atfork_unlock, + Perl_atfork_unlock); +#endif + if (!PL_do_undump) { my_perl = perl_alloc(); if (!my_perl) diff --git a/perl.c b/perl.c index 90d7134..2b731c4 100644 --- a/perl.c +++ b/perl.c @@ -59,12 +59,9 @@ static I32 read_e_script(pTHXo_ int idx, SV *buf_sv, int maxlen); #else # if defined(USE_ITHREADS) -static void S_atfork_lock(void); -static void S_atfork_unlock(void); - /* this is called in parent before the fork() */ -static void -S_atfork_lock(void) +void +Perl_atfork_lock(void) { /* locks must be held in locking order (if any) */ #ifdef MYMALLOC @@ -74,8 +71,8 @@ S_atfork_lock(void) } /* this is called in both parent and child after the fork() */ -static void -S_atfork_unlock(void) +void +Perl_atfork_unlock(void) { /* locks must be released in same order as in S_atfork_lock() */ #ifdef MYMALLOC @@ -92,9 +89,6 @@ S_atfork_unlock(void) ALLOC_THREAD_KEY; \ PERL_SET_THX(my_perl); \ OP_REFCNT_INIT; \ - PTHREAD_ATFORK(S_atfork_lock, \ - S_atfork_unlock, \ - S_atfork_unlock); \ } \ else { \ PERL_SET_THX(my_perl); \