From: Artur Bergman Date: Wed, 13 Feb 2002 12:46:11 +0000 (+0000) Subject: Track active threads.... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=149bd5a9d6591dc9e450bc1ac8ad638f42acd9c5;p=p5sagit%2Fp5-mst-13.2.git Track active threads.... p4raw-id: //depot/perl@14678 --- diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs index 88f2c04..906828f 100755 --- a/ext/threads/threads.xs +++ b/ext/threads/threads.xs @@ -72,7 +72,7 @@ ithread *threads; static perl_mutex create_mutex; /* protects the creation of threads ??? */ I32 tid_counter = 0; - +I32 active_threads = 0; perl_key self_key; /* @@ -99,6 +99,7 @@ Perl_ithread_destruct (pTHX_ ithread* thread) threads = thread->next; } } + active_threads--; MUTEX_UNLOCK(&create_mutex); /* Thread is now disowned */ #if 0 @@ -367,6 +368,7 @@ Perl_ithread_create(pTHX_ SV *obj, char* classname, SV* init_function, SV* param #endif } #endif + active_threads++; MUTEX_UNLOCK(&create_mutex); return ithread_to_SV(aTHX_ obj, thread, classname, FALSE); } @@ -542,6 +544,7 @@ BOOT: thread->interp = aTHX; thread->count = 1; /* imortal */ thread->tid = tid_counter++; + active_threads++; thread->detached = 1; #ifdef WIN32 thread->thr = GetCurrentThreadId();