From: Gurusamy Sarathy Date: Thu, 16 Oct 1997 20:45:58 +0000 (+0000) Subject: A quick merge of latest mainline. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a7f1e86fb26062105dfcdd982330f8ac5f43b866;p=p5sagit%2Fp5-mst-13.2.git A quick merge of latest mainline. p4raw-id: //depot/win32/perl@143 --- a7f1e86fb26062105dfcdd982330f8ac5f43b866 diff --cc perl.c index 1049366,5a2dd70..2d94f4d --- a/perl.c +++ b/perl.c @@@ -121,10 -121,13 +121,13 @@@ register PerlInterpreter *sv_interp /* Init the real globals (and main thread)? */ if (!linestr) { #ifdef USE_THREADS + XPV *xpv; + INIT_THREADS; - New(53, thr, 1, struct thread); + Newz(53, thr, 1, struct thread); MUTEX_INIT(&malloc_mutex); MUTEX_INIT(&sv_mutex); + /* Safe to use SVs from now on */ MUTEX_INIT(&eval_mutex); COND_INIT(&eval_cond); MUTEX_INIT(&threads_mutex); @@@ -267,13 -272,14 +287,19 @@@ register PerlInterpreter *sv_interp ThrSETSTATE(t, THRf_DEAD); MUTEX_UNLOCK(&t->mutex); nthreads--; + /* + * The SvREFCNT_dec below may take a long time (e.g. av + * may contain an object scalar whose destructor gets + * called) so we have to unlock threads_mutex and start + * all over again. + */ MUTEX_UNLOCK(&threads_mutex); +#ifdef WIN32 + if ((WaitForSingleObject(t->Tself,INFINITE) == WAIT_FAILED) + || (GetExitCodeThread(t->Tself,(LPDWORD)&av) == 0)) +#else if (pthread_join(t->Tself, (void**)&av)) +#endif croak("panic: pthread_join failed during global destruction"); SvREFCNT_dec((SV*)av); DEBUG_L(PerlIO_printf(PerlIO_stderr(),