mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[RTL]
- Allow the thread that called LdrShutdownProcess to forcefully acquire critical sections (the loader lock in particular). This fixes the race condition where ExitProcess might terminate a thread holding the loader lock and subsequently call LdrShutdownProcess. That would then result in a deadlock because LdrShutdownProcess cannot acquire the loader lock. This is a pretty ugly hack... but at least Windows does it the same way. Fixes hangs after the summary line when running mshtml tests. CORE-8624 #resolve svn path=/trunk/; revision=64702
This commit is contained in:
parent
ae24fd4e41
commit
b62c758526
1 changed files with 15 additions and 0 deletions
|
@ -23,6 +23,9 @@ static RTL_CRITICAL_SECTION_DEBUG RtlpStaticDebugInfo[MAX_STATIC_CS_DEBUG_OBJECT
|
|||
static BOOLEAN RtlpDebugInfoFreeList[MAX_STATIC_CS_DEBUG_OBJECTS];
|
||||
LARGE_INTEGER RtlpTimeout;
|
||||
|
||||
extern BOOLEAN LdrpShutdownInProgress;
|
||||
extern HANDLE LdrpShutdownThreadId;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*++
|
||||
|
@ -125,6 +128,18 @@ RtlpWaitForCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
|
|||
if (CriticalSection->DebugInfo)
|
||||
CriticalSection->DebugInfo->EntryCount++;
|
||||
|
||||
/*
|
||||
* If we're shutting down the process, we're allowed to acquire any
|
||||
* critical sections by force (the loader lock in particular)
|
||||
*/
|
||||
if (LdrpShutdownInProgress &&
|
||||
LdrpShutdownThreadId == NtCurrentTeb()->RealClientId.UniqueThread)
|
||||
{
|
||||
DPRINT("Forcing ownership of critical section %p\n", CriticalSection);
|
||||
CriticalSection->LockCount = 0;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Increase the number of times we've had contention */
|
||||
|
|
Loading…
Reference in a new issue