diff options
author | rpj <rpj> | 2003-08-14 08:53:17 +0000 |
---|---|---|
committer | rpj <rpj> | 2003-08-14 08:53:17 +0000 |
commit | a50745ec922a917513029f3f87bf820827b43f29 (patch) | |
tree | 1e221862e0550d163baef12d17634430ae677824 /ptw32_processTerminate.c | |
parent | 414f4bd7e70d94025576d9264c86da63c506f6ca (diff) |
Reuse of thread IDs, improved thread ID validation, new tests, bug fixes.
Diffstat (limited to 'ptw32_processTerminate.c')
-rw-r--r-- | ptw32_processTerminate.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ptw32_processTerminate.c b/ptw32_processTerminate.c index d816a4b..950598d 100644 --- a/ptw32_processTerminate.c +++ b/ptw32_processTerminate.c @@ -62,6 +62,9 @@ ptw32_processTerminate (void) * ------------------------------------------------------ */ { + pthread_t thread, + nextThread; + if (ptw32_processInitialized) { @@ -85,6 +88,18 @@ ptw32_processTerminate (void) ptw32_cleanupKey = NULL; } + EnterCriticalSection(&ptw32_thread_reuse_lock); + + thread = ptw32_threadReuseTop; + while (thread != PTW32_THREAD_REUSE_BOTTOM) + { + nextThread = thread->prevReuse; + free(thread); + thread = nextThread; + } + + LeaveCriticalSection(&ptw32_thread_reuse_lock); + /* * Destroy the global locks. */ @@ -93,6 +108,7 @@ ptw32_processTerminate (void) DeleteCriticalSection(&ptw32_cond_test_init_lock); DeleteCriticalSection(&ptw32_cond_list_lock); DeleteCriticalSection(&ptw32_mutex_test_init_lock); + DeleteCriticalSection(&ptw32_thread_reuse_lock); ptw32_processInitialized = FALSE; } |