Bugzilla bug 95836: Added _PR_CleanupIO() and made it call
_PR_CleanupFdCache(). PR_Cleanup() now calls _PR_CleanupIO() and does not call _PR_CleanupFdCache() directly. Modified files: primpl.h prio.c prinit.c ptio.c ptthread.c
This commit is contained in:
Родитель
f4947beffa
Коммит
18df9ed3c3
|
@ -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_CleanupEnv(void);
|
||||
extern void _PR_CleanupIO(void);
|
||||
extern void _PR_CleanupLayerCache(void);
|
||||
extern void _PR_CleanupStacks(void);
|
||||
extern void _PR_CleanupThreads(void);
|
||||
|
|
|
@ -75,6 +75,27 @@ void _PR_InitIO(void)
|
|||
_PR_MD_INIT_IO();
|
||||
}
|
||||
|
||||
void _PR_CleanupIO(void)
|
||||
{
|
||||
PR_FreeFileDesc(_pr_stdin);
|
||||
_pr_stdin = NULL;
|
||||
PR_FreeFileDesc(_pr_stdout);
|
||||
_pr_stdout = NULL;
|
||||
PR_FreeFileDesc(_pr_stderr);
|
||||
_pr_stderr = NULL;
|
||||
|
||||
if (_pr_flock_cv) {
|
||||
PR_DestroyCondVar(_pr_flock_cv);
|
||||
_pr_flock_cv = NULL;
|
||||
}
|
||||
if (_pr_flock_lock) {
|
||||
PR_DestroyLock(_pr_flock_lock);
|
||||
_pr_flock_lock = NULL;
|
||||
}
|
||||
|
||||
_PR_CleanupFdCache();
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRFileDesc*) PR_GetSpecialFD(PRSpecialFD osfd)
|
||||
{
|
||||
PRFileDesc *result = NULL;
|
||||
|
|
|
@ -424,7 +424,6 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
|
|||
PR_LOG(_pr_thread_lm, PR_LOG_MIN,
|
||||
("PR_Cleanup: clean up before destroying thread"));
|
||||
_PR_LogCleanup();
|
||||
_PR_CleanupFdCache();
|
||||
|
||||
/*
|
||||
* This part should look like the end of _PR_NativeRunThread
|
||||
|
@ -446,6 +445,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
|
|||
* Ideally, for each _PR_InitXXX(), there should be a corresponding
|
||||
* _PR_XXXCleanup() that we can call here.
|
||||
*/
|
||||
_PR_CleanupIO();
|
||||
_PR_CleanupThreads();
|
||||
PR_DestroyLock(_pr_sleeplock);
|
||||
_pr_sleeplock = NULL;
|
||||
|
|
|
@ -1080,6 +1080,34 @@ void _PR_InitIO()
|
|||
|
||||
} /* _PR_InitIO */
|
||||
|
||||
void _PR_CleanupIO(void)
|
||||
{
|
||||
_PR_Putfd(_pr_stdin);
|
||||
_pr_stdin = NULL;
|
||||
_PR_Putfd(_pr_stdout);
|
||||
_pr_stdout = NULL;
|
||||
_PR_Putfd(_pr_stderr);
|
||||
_pr_stderr = NULL;
|
||||
|
||||
_PR_CleanupFdCache();
|
||||
|
||||
if (_pr_flock_cv)
|
||||
{
|
||||
PR_DestroyCondVar(_pr_flock_cv);
|
||||
_pr_flock_cv = NULL;
|
||||
}
|
||||
if (_pr_flock_lock)
|
||||
{
|
||||
PR_DestroyLock(_pr_flock_lock);
|
||||
_pr_flock_lock = NULL;
|
||||
}
|
||||
if (_pr_rename_lock)
|
||||
{
|
||||
PR_DestroyLock(_pr_rename_lock);
|
||||
_pr_rename_lock = NULL;
|
||||
}
|
||||
} /* _PR_CleanupIO */
|
||||
|
||||
PR_IMPLEMENT(PRFileDesc*) PR_GetSpecialFD(PRSpecialFD osfd)
|
||||
{
|
||||
PRFileDesc *result = NULL;
|
||||
|
|
|
@ -921,8 +921,8 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
|
|||
PR_Unlock(pt_book.ml);
|
||||
|
||||
_PR_LogCleanup();
|
||||
/* Close all the fd's before calling _PR_CleanupFdCache */
|
||||
_PR_CleanupFdCache();
|
||||
/* Close all the fd's before calling _PR_CleanupIO */
|
||||
_PR_CleanupIO();
|
||||
|
||||
/*
|
||||
* I am not sure if it's safe to delete the cv and lock here,
|
||||
|
|
Загрузка…
Ссылка в новой задаче