diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2001-07-05 00:42:49 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2001-07-05 00:42:49 +0000 |
commit | 7d8f4fe511c0e703b183bbd6e19c8b6ca13f3dc9 (patch) | |
tree | 75623d7252059f79bb9271a8ea59619aaee0be4f /thread.h | |
parent | 3807896f8955d7e06d3507258eae5341191ffa1a (diff) | |
download | perl-7d8f4fe511c0e703b183bbd6e19c8b6ca13f3dc9.tar.gz |
perl built with USE_ITHREADS can deadlock during fork() or backticks
since it doesn't ensure threads other than the one calling fork()
aren't holding any locks; the fix is to use pthread_atfork() to
hold global locks
building perl with -Dusemymalloc exacerbates the problem since
Perl_malloc() holds a mutex, and perl's exec() calls New()
XXX the code in win32thread.h may be needed on platforms that have
no pthread_atfork()
p4raw-id: //depot/perl@11151
Diffstat (limited to 'thread.h')
-rw-r--r-- | thread.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -302,6 +302,11 @@ } STMT_END #endif +#ifndef PTHREAD_ATFORK +# define PTHREAD_ATFORK(prepare,parent,child) \ + pthread_atfork(prepare,parent,child) +#endif + #ifndef THREAD_RET_TYPE # define THREAD_RET_TYPE void * # define THREAD_RET_CAST(p) ((void *)(p)) @@ -456,3 +461,7 @@ typedef struct condpair { #ifndef INIT_THREADS # define INIT_THREADS NOOP #endif + +#ifndef PTHREAD_ATFORK +# define PTHREAD_ATFORK(prepare,parent,child) NOOP +#endif |