Bugzilla bug 95839: added _PR_CleanupNet() to destroy the locks created by

_PR_InitNet().  The patch is contributed by Jeff Hostetler
<jeff@NerdOne.com>.
Modified files: primpl.h prinit.c prnetdb.c ptthread.c
This commit is contained in:
wtc%netscape.com 2001-12-27 19:59:35 +00:00
Родитель 5811457b66
Коммит da72675bf3
4 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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.

Просмотреть файл

@ -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();