X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=thread.h;h=695f288c4bc314532cbfc0d4cb1645a341ae75d0;hb=2a40f0e39716e28dbf4254a185c6e067b731a67f;hp=1312b300dc179105f4c0b9cd0ab47b3b8a822fd2;hpb=136666271df3fddb92143e6fabf3bda463294b22;p=p5sagit%2Fp5-mst-13.2.git diff --git a/thread.h b/thread.h index 1312b30..695f288 100644 --- a/thread.h +++ b/thread.h @@ -50,6 +50,14 @@ struct perl_thread *getTHR _((void)); # define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_attr_setdetachstate(a,s) #endif +#ifndef PTHREAD_CREATE_JOINABLE +# ifdef OLD_PTHREAD_CREATE_JOINABLE +# define PTHREAD_CREATE_JOINABLE OLD_PTHREAD_CREATE_JOINABLE +# else +# define PTHREAD_CREATE_JOINABLE 0 /* Panic? No, guess. */ +# endif +#endif + #ifdef I_MACH_CTHREADS /* cthreads interface */ @@ -216,6 +224,8 @@ struct perl_thread *getTHR _((void)); * from thrsv which is cached in the per-interpreter structure. * Systems with very fast pthread_get_specific (which should be all systems * but unfortunately isn't) may wish to simplify to "...*thr = THR". + * + * The use of PL_threadnum should be safe here. */ #ifndef dTHR # define dTHR \ @@ -238,30 +248,27 @@ struct perl_thread *getTHR _((void)); * try only locking them if there may be more than one thread in existence. * Systems with very fast mutexes (and/or slow conditionals) may wish to * remove the "if (threadnum) ..." test. + * XXX do NOT use C -- it sets up race conditions! */ #define LOCK_SV_MUTEX \ STMT_START { \ - if (PL_threadnum) \ - MUTEX_LOCK(&PL_sv_mutex); \ + MUTEX_LOCK(&PL_sv_mutex); \ } STMT_END #define UNLOCK_SV_MUTEX \ STMT_START { \ - if (PL_threadnum) \ - MUTEX_UNLOCK(&PL_sv_mutex); \ + MUTEX_UNLOCK(&PL_sv_mutex); \ } STMT_END /* Likewise for strtab_mutex */ #define LOCK_STRTAB_MUTEX \ STMT_START { \ - if (PL_threadnum) \ - MUTEX_LOCK(&PL_strtab_mutex); \ + MUTEX_LOCK(&PL_strtab_mutex); \ } STMT_END #define UNLOCK_STRTAB_MUTEX \ STMT_START { \ - if (PL_threadnum) \ - MUTEX_UNLOCK(&PL_strtab_mutex); \ + MUTEX_UNLOCK(&PL_strtab_mutex); \ } STMT_END #ifndef THREAD_RET_TYPE