summaryrefslogtreecommitdiff
path: root/pr
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2001-08-29 23:52:14 +0000
committerwtc%netscape.com <devnull@localhost>2001-08-29 23:52:14 +0000
commit5644ced824ef122aebbaab631b7ef27e57308fae (patch)
tree2cc9e71e2684d7d79460a40b8313a34b2a51fe02 /pr
parent359d447f593c8513443c8007e9026bbfc9b9589f (diff)
downloadnspr-hg-5644ced824ef122aebbaab631b7ef27e57308fae.tar.gz
Bugzilla bug 95668: added _PR_CleanupThreads and call it from PR_Cleanup.
The patch is contributed by jeff@NerdOne.com. Modified files: primpl.h, prinit.c, pruthr.c.
Diffstat (limited to 'pr')
-rw-r--r--pr/include/private/primpl.h1
-rw-r--r--pr/src/misc/prinit.c1
-rw-r--r--pr/src/threads/combined/pruthr.c21
3 files changed, 23 insertions, 0 deletions
diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h
index 328d0f1f..424d0f1e 100644
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -1736,6 +1736,7 @@ extern void _PR_InitRWLocks(void);
extern void _PR_NotifyCondVar(PRCondVar *cvar, PRThread *me);
extern void _PR_CleanupThread(PRThread *thread);
extern void _PR_CleanupStacks(void);
+extern void _PR_CleanupThreads(void);
extern void _PR_CleanupTPD(void);
extern void _PR_Cleanup(void);
extern void _PR_LogCleanup(void);
diff --git a/pr/src/misc/prinit.c b/pr/src/misc/prinit.c
index 78c4dff3..bfa59fa0 100644
--- a/pr/src/misc/prinit.c
+++ b/pr/src/misc/prinit.c
@@ -446,6 +446,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
* Ideally, for each _PR_InitXXX(), there should be a corresponding
* _PR_XXXCleanup() that we can call here.
*/
+ _PR_CleanupThreads();
_PR_CleanupStacks();
_PR_CleanupBeforeExit();
_pr_initialized = PR_FALSE;
diff --git a/pr/src/threads/combined/pruthr.c b/pr/src/threads/combined/pruthr.c
index ac7e9eb6..77236df1 100644
--- a/pr/src/threads/combined/pruthr.c
+++ b/pr/src/threads/combined/pruthr.c
@@ -179,6 +179,27 @@ void _PR_InitThreads(PRThreadType type, PRThreadPriority priority,
PR_INIT_CLIST(&_pr_deadUserQ);
}
+void _PR_CleanupThreads(void)
+{
+ if (_pr_terminationCVLock) {
+ PR_DestroyLock(_pr_terminationCVLock);
+ _pr_terminationCVLock = NULL;
+ }
+ if (_pr_activeLock) {
+ PR_DestroyLock(_pr_activeLock);
+ _pr_activeLock = NULL;
+ }
+ if (_pr_primordialExitCVar) {
+ PR_DestroyCondVar(_pr_primordialExitCVar);
+ _pr_primordialExitCVar = NULL;
+ }
+ /* TODO _pr_dead{Native,User}Q need to be deleted */
+ if (_pr_deadQLock) {
+ PR_DestroyLock(_pr_deadQLock);
+ _pr_deadQLock = NULL;
+ }
+}
+
/*
** Initialize a stack for a native thread
*/