fixing double locking issue (#637)
This commit is contained in:
parent
f32addd408
commit
419ae06935
|
|
@ -150,13 +150,17 @@ IN_PROCESS_APPLICATION::Recycle(
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
BOOL fLockAcquired = FALSE;
|
||||||
// We need to guarantee that recycle is only called once, as calling pHttpServer->RecycleProcess
|
// We need to guarantee that recycle is only called once, as calling pHttpServer->RecycleProcess
|
||||||
// multiple times can lead to AVs.
|
// multiple times can lead to AVs.
|
||||||
if (m_fRecycleCalled)
|
if (m_fRecycleCalled)
|
||||||
{
|
{
|
||||||
return;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
AcquireSRWLockExclusive(&m_srwLock);
|
AcquireSRWLockExclusive(&m_srwLock);
|
||||||
|
fLockAcquired = TRUE;
|
||||||
|
|
||||||
if (m_fRecycleCalled)
|
if (m_fRecycleCalled)
|
||||||
{
|
{
|
||||||
goto Finished;
|
goto Finished;
|
||||||
|
|
@ -170,12 +174,20 @@ IN_PROCESS_APPLICATION::Recycle(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// IISExpress scenario
|
// IISExpress scenario
|
||||||
// Can only call exit to terminate current process
|
// Release the lock first as Shutdown will acquire lock later
|
||||||
|
ReleaseSRWLockExclusive(&m_srwLock);
|
||||||
|
fLockAcquired = FALSE;
|
||||||
|
|
||||||
|
// Shutdown the managed application and call exit to terminate current process
|
||||||
ShutDown();
|
ShutDown();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Finished:
|
Finished:
|
||||||
ReleaseSRWLockExclusive(&m_srwLock);
|
if (fLockAcquired)
|
||||||
|
{
|
||||||
|
ReleaseSRWLockExclusive(&m_srwLock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUEST_NOTIFICATION_STATUS
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue