From fef63d6cf7c2bf6aacb13afc609adefd6db07735 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Thu, 27 Dec 2001 19:59:35 +0000 Subject: [PATCH] Bugzilla bug 95839: added _PR_CleanupNet() to destroy the locks created by _PR_InitNet(). The patch is contributed by Jeff Hostetler . Modified files: primpl.h prinit.c prnetdb.c ptthread.c git-svn-id: svn://10.0.0.236/trunk@111111 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/nsprpub/pr/include/private/primpl.h | 1 + mozilla/nsprpub/pr/src/misc/prinit.c | 1 + mozilla/nsprpub/pr/src/misc/prnetdb.c | 16 ++++++++++++++++ mozilla/nsprpub/pr/src/pthreads/ptthread.c | 1 + 4 files changed, 19 insertions(+) diff --git a/mozilla/nsprpub/pr/include/private/primpl.h b/mozilla/nsprpub/pr/include/private/primpl.h index 8501c0e0ee5..534a457f5a9 100644 --- a/mozilla/nsprpub/pr/include/private/primpl.h +++ b/mozilla/nsprpub/pr/include/private/primpl.h @@ -1743,6 +1743,7 @@ extern void _PR_NotifyCondVar(PRCondVar *cvar, PRThread *me); extern void _PR_CleanupThread(PRThread *thread); extern void _PR_CleanupEnv(void); extern void _PR_CleanupIO(void); +extern void _PR_CleanupNet(void); extern void _PR_CleanupLayerCache(void); extern void _PR_CleanupStacks(void); extern void _PR_CleanupThreads(void); diff --git a/mozilla/nsprpub/pr/src/misc/prinit.c b/mozilla/nsprpub/pr/src/misc/prinit.c index 6da27fa0fdb..3de1a2cc36b 100644 --- a/mozilla/nsprpub/pr/src/misc/prinit.c +++ b/mozilla/nsprpub/pr/src/misc/prinit.c @@ -449,6 +449,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() * Ideally, for each _PR_InitXXX(), there should be a corresponding * _PR_XXXCleanup() that we can call here. */ + _PR_CleanupNet(); _PR_CleanupIO(); _PR_CleanupThreads(); PR_DestroyLock(_pr_sleeplock); diff --git a/mozilla/nsprpub/pr/src/misc/prnetdb.c b/mozilla/nsprpub/pr/src/misc/prnetdb.c index b40ca804b1c..d5ca936941c 100644 --- a/mozilla/nsprpub/pr/src/misc/prnetdb.c +++ b/mozilla/nsprpub/pr/src/misc/prnetdb.c @@ -176,6 +176,22 @@ void _PR_InitNet(void) #endif } +void _PR_CleanupNet(void) +{ +#if !defined(_PR_NO_DNS_LOCK) + if (_pr_dnsLock) { + PR_DestroyLock(_pr_dnsLock); + _pr_dnsLock = NULL; + } +#endif +#if !defined(_PR_HAVE_GETPROTO_R) + if (_getproto_lock) { + PR_DestroyLock(_getproto_lock); + _getproto_lock = NULL; + } +#endif +} + /* ** Allocate space from the buffer, aligning it to "align" before doing ** the allocation. "align" must be a power of 2. diff --git a/mozilla/nsprpub/pr/src/pthreads/ptthread.c b/mozilla/nsprpub/pr/src/pthreads/ptthread.c index dc8cc1272c0..2dafff7258f 100644 --- a/mozilla/nsprpub/pr/src/pthreads/ptthread.c +++ b/mozilla/nsprpub/pr/src/pthreads/ptthread.c @@ -921,6 +921,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() PR_Unlock(pt_book.ml); _PR_LogCleanup(); + _PR_CleanupNet(); /* Close all the fd's before calling _PR_CleanupIO */ _PR_CleanupIO();