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

pthread_atfork problem

Thread Next
Doug MacEachern
July 10, 2001 09:27
pthread_atfork problem
Message ID:
current bleedperl causes deadlock when using perl_clone(), since the
pthread_atfork call happens once for each clone.  it could be moved to
PERL_SYS_INIT to prevent this, but still presents a problem for mod_perl.
when apache starts it dlopen's, and calls the module init
function which will call PERL_SYS_INIT and construct all the interpreters.
apache restarts itself at startup, so this happens twice at startup, then
once for each restart.
however, Perl's atfork handlers can only be registered _once_ per process,
else there is deadlock.  so in my fiddling, modperl needs to call
PTHREAD_ATFORK itself with special care so that it only happens _once_.  i
believe this will still be a problem, since pthread_atfork was given
function pointers to things in which is closed/opened on
restarts and may not have the same address afterwards.  i don't see any
function to clear the atfork handlers.  might need to consider
alternatives to using pthread_atfork?

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About