develooper Front page | perl.perl5.porters | Postings from July 2001

Re: [patch] pthread_atfork bandaid

Thread Previous | Thread Next
From:
Doug MacEachern
Date:
July 11, 2001 23:13
Subject:
Re: [patch] pthread_atfork bandaid
Message ID:
Pine.LNX.4.21.0107112308110.28844-100000@mako.covalent.net
On Thu, 12 Jul 2001, Jarkko Hietaniemi wrote:
 
> *cough*  Take a look at the patch you sent to perl5-porters.

whoops, that was not the whole patch.  and the prototypes were moved to
thread.h, not unixish.h.  which i think is the right place since 'atfork'
handlers for another (non posix pthread) platform might have a different
protoype.

Index: miniperlmain.c
===================================================================
RCS file: /usr/local/cvs_repository/perl-current-mirror/miniperlmain.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 miniperlmain.c
--- miniperlmain.c	2001/06/13 15:17:01	1.1.1.3
+++ miniperlmain.c	2001/07/12 06:03:31
@@ -48,6 +48,12 @@
 
     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)
Index: perl.c
===================================================================
RCS file: /usr/local/cvs_repository/perl-current-mirror/perl.c,v
retrieving revision 1.1.1.37
diff -u -r1.1.1.37 perl.c
--- perl.c	2001/07/11 15:26:26	1.1.1.37
+++ perl.c	2001/07/12 06:03:31
@@ -59,12 +59,9 @@
 #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 @@
 }
 
 /* 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 @@
 	    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);		\
Index: thread.h
===================================================================
RCS file: /usr/local/cvs_repository/perl-current-mirror/thread.h,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 thread.h
--- thread.h	2001/07/05 13:05:44	1.1.1.9
+++ thread.h	2001/07/12 06:05:05
@@ -302,6 +302,9 @@
     } STMT_END
 #endif
 
+void Perl_atfork_lock(void);
+void Perl_atfork_unlock(void);
+
 #ifndef PTHREAD_ATFORK
 #  define PTHREAD_ATFORK(prepare,parent,child)			\
     pthread_atfork(prepare,parent,child)


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About