Bugzilla bug 95773: Added _PR_CleanupEnv() and call it from PR_Cleanup().

The patch is contributed by jeff@NerdOne.com.
Modified files: primpl.h prenv.c prinit.c ptthread.c
This commit is contained in:
wtc%netscape.com 2001-09-07 00:05:50 +00:00
parent 412ef306b5
commit c57ef1ff46
4 changed files with 12 additions and 0 deletions

View File

@ -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_CleanupEnv(void);
extern void _PR_CleanupLayerCache(void);
extern void _PR_CleanupStacks(void);
extern void _PR_CleanupThreads(void);

View File

@ -38,17 +38,21 @@
/* Lock used to lock the environment */
#if defined(_PR_NO_PREEMPT)
#define _PR_NEW_LOCK_ENV()
#define _PR_DELETE_LOCK_ENV()
#define _PR_LOCK_ENV()
#define _PR_UNLOCK_ENV()
#elif defined(_PR_LOCAL_THREADS_ONLY)
extern _PRCPU * _pr_primordialCPU;
static PRIntn _is;
#define _PR_NEW_LOCK_ENV()
#define _PR_DELETE_LOCK_ENV()
#define _PR_LOCK_ENV() if (_pr_primordialCPU) _PR_INTSOFF(_is);
#define _PR_UNLOCK_ENV() if (_pr_primordialCPU) _PR_INTSON(_is);
#else
static PRLock *_pr_envLock = NULL;
#define _PR_NEW_LOCK_ENV() {_pr_envLock = PR_NewLock();}
#define _PR_DELETE_LOCK_ENV() \
{ if (_pr_envLock) { PR_DestroyLock(_pr_envLock); _pr_envLock = NULL; } }
#define _PR_LOCK_ENV() { if (_pr_envLock) PR_Lock(_pr_envLock); }
#define _PR_UNLOCK_ENV() { if (_pr_envLock) PR_Unlock(_pr_envLock); }
#endif
@ -60,6 +64,11 @@ void _PR_InitEnv()
_PR_NEW_LOCK_ENV();
}
void _PR_CleanupEnv(void)
{
_PR_DELETE_LOCK_ENV();
}
PR_IMPLEMENT(char*) PR_GetEnv(const char *var)
{
char *ev;

View File

@ -448,6 +448,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
*/
_PR_CleanupThreads();
_PR_CleanupLayerCache();
_PR_CleanupEnv();
_PR_CleanupStacks();
_PR_CleanupBeforeExit();
_pr_initialized = PR_FALSE;

View File

@ -937,6 +937,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
}
_pt_thread_death(me);
_PR_CleanupLayerCache();
_PR_CleanupEnv();
_pr_initialized = PR_FALSE;
return PR_SUCCESS;
}