Do not call thread attach/detach routines during process exit to avoid

potential deadlocks.
This commit is contained in:
Alexandre Julliard 2000-12-20 18:41:34 +00:00
parent cb0ce33877
commit 014a8bb1e3

View file

@ -28,6 +28,7 @@ WINE_MODREF *MODULE_modref_list = NULL;
static WINE_MODREF *exe_modref;
static int free_lib_count; /* recursion depth of FreeLibrary calls */
static int process_detaching; /* set on process detach to avoid deadlocks with thread detach */
/*************************************************************************
* MODULE32_LookupHMODULE
@ -215,7 +216,7 @@ void MODULE_DllProcessDetach( BOOL bForceDetach, LPVOID lpReserved )
WINE_MODREF *wm;
RtlAcquirePebLock();
if (bForceDetach) process_detaching = 1;
do
{
for ( wm = MODULE_modref_list; wm; wm = wm->next )
@ -250,6 +251,10 @@ void MODULE_DllThreadAttach( LPVOID lpReserved )
{
WINE_MODREF *wm;
/* don't do any attach calls if process is exiting */
if (process_detaching) return;
/* FIXME: there is still a race here */
RtlAcquirePebLock();
for ( wm = MODULE_modref_list; wm; wm = wm->next )
@ -280,6 +285,10 @@ void MODULE_DllThreadDetach( LPVOID lpReserved )
{
WINE_MODREF *wm;
/* don't do any detach calls if process is exiting */
if (process_detaching) return;
/* FIXME: there is still a race here */
RtlAcquirePebLock();
for ( wm = MODULE_modref_list; wm; wm = wm->next )