From d04c389511dc8d4b53c969704a3af77f51f341af Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Wed, 29 Aug 2001 23:13:41 +0000 Subject: [PATCH] Bugzilla bug 95659: added _PR_CleanupStacks(), which is called from PR_Cleanup(). The patch is contributed by jeff@NerdOne.com. Modified files: primpl.h, prinit.c, prustack.c --- nsprpub/pr/include/private/primpl.h | 1 + nsprpub/pr/src/misc/prinit.c | 1 + nsprpub/pr/src/threads/combined/prustack.c | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/nsprpub/pr/include/private/primpl.h b/nsprpub/pr/include/private/primpl.h index eb1dd716e2a..328d0f1fbb0 100644 --- a/nsprpub/pr/include/private/primpl.h +++ b/nsprpub/pr/include/private/primpl.h @@ -1735,6 +1735,7 @@ extern void _PR_InitMW(void); 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_CleanupTPD(void); extern void _PR_Cleanup(void); extern void _PR_LogCleanup(void); diff --git a/nsprpub/pr/src/misc/prinit.c b/nsprpub/pr/src/misc/prinit.c index 46cd57df417..78c4dff3296 100644 --- a/nsprpub/pr/src/misc/prinit.c +++ b/nsprpub/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_CleanupStacks(); _PR_CleanupBeforeExit(); _pr_initialized = PR_FALSE; return PR_SUCCESS; diff --git a/nsprpub/pr/src/threads/combined/prustack.c b/nsprpub/pr/src/threads/combined/prustack.c index aa7d2bfada0..3f12c568d01 100644 --- a/nsprpub/pr/src/threads/combined/prustack.c +++ b/nsprpub/pr/src/threads/combined/prustack.c @@ -58,6 +58,14 @@ void _PR_InitStacks(void) _pr_stackLock = PR_NewLock(); } +void _PR_CleanupStacks(void) +{ + if (_pr_stackLock) { + PR_DestroyLock(_pr_stackLock); + _pr_stackLock = NULL; + } +} + /* ** Allocate a stack for a thread. */