From: Artur Bergman Date: Sat, 8 Jun 2002 10:06:05 +0000 (+0000) Subject: Fix for bug [ID 20020602.007]. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=91604d216ebac8463b9593f4d809ca0d39bb6ff8;p=p5sagit%2Fp5-mst-13.2.git Fix for bug [ID 20020602.007]. Don't decrement the active flag until AFTER we have run perl_destruct p4raw-id: //depot/perl@17080 --- diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs index cbe4e04..e1f6c9a 100755 --- a/ext/threads/threads.xs +++ b/ext/threads/threads.xs @@ -288,10 +288,6 @@ Perl_ithread_run(void * arg) { } PerlIO_flush((PerlIO*)NULL); - MUTEX_LOCK(&create_destruct_mutex); - active_threads--; - assert( active_threads >= 0 ); - MUTEX_UNLOCK(&create_destruct_mutex); MUTEX_LOCK(&thread->mutex); thread->state |= PERL_ITHR_FINISHED; @@ -301,6 +297,11 @@ Perl_ithread_run(void * arg) { } else { MUTEX_UNLOCK(&thread->mutex); } + MUTEX_LOCK(&create_destruct_mutex); + active_threads--; + assert( active_threads >= 0 ); + MUTEX_UNLOCK(&create_destruct_mutex); + #ifdef WIN32 return (DWORD)0; #else