mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Fix zombie plCrashHandler issues
Win32 HACK: We wait on both the pfCrashCli handle and the crashed semaphore. This way, we can proceed to exit pfCrashSrv when the client process exits insanely.
This commit is contained in:
@ -115,7 +115,11 @@ class hsMutex {
|
|||||||
public:
|
public:
|
||||||
hsMutex();
|
hsMutex();
|
||||||
virtual ~hsMutex();
|
virtual ~hsMutex();
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
HANDLE GetHandle() const { return fMutexH; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void Lock();
|
void Lock();
|
||||||
hsBool TryLock();
|
hsBool TryLock();
|
||||||
void Unlock();
|
void Unlock();
|
||||||
@ -157,6 +161,10 @@ public:
|
|||||||
hsSemaphore(int initialValue=0, const char* name=nil);
|
hsSemaphore(int initialValue=0, const char* name=nil);
|
||||||
~hsSemaphore();
|
~hsSemaphore();
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
HANDLE GetHandle() const { return fSemaH; }
|
||||||
|
#endif
|
||||||
|
|
||||||
hsBool TryWait();
|
hsBool TryWait();
|
||||||
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||||
void Signal();
|
void Signal();
|
||||||
@ -183,6 +191,10 @@ public:
|
|||||||
hsEvent();
|
hsEvent();
|
||||||
~hsEvent();
|
~hsEvent();
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
HANDLE GetHandle() const { return fEvent; }
|
||||||
|
#endif
|
||||||
|
|
||||||
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||||
void Signal();
|
void Signal();
|
||||||
};
|
};
|
||||||
|
@ -108,10 +108,21 @@ void plCrashSrv::IHandleCrash()
|
|||||||
|
|
||||||
void plCrashSrv::HandleCrash()
|
void plCrashSrv::HandleCrash()
|
||||||
{
|
{
|
||||||
fCrashed->Wait(); // Wait for a crash
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
if (!fLink)
|
if (!fLink)
|
||||||
FATAL("plCrashMemLink is nil!");
|
FATAL("plCrashMemLink is nil!");
|
||||||
else if (fLink->fCrashed)
|
|
||||||
|
// In Win32 land we have to hackily handle the client process exiting, so we'll wait on both
|
||||||
|
// the crashed semaphore and the client process...
|
||||||
|
HANDLE hack[2] = { fLink->fClientProcess, fCrashed->GetHandle() };
|
||||||
|
DWORD result = WaitForMultipleObjects(arrsize(hack), hack, FALSE, INFINITE);
|
||||||
|
hsAssert(result != WAIT_FAILED, "WaitForMultipleObjects failed");
|
||||||
|
#else
|
||||||
|
fCrashed->Wait();
|
||||||
|
if (!fLink)
|
||||||
|
FATAL("plCrashMemLink is nil!");
|
||||||
|
#endif
|
||||||
|
if (fLink->fCrashed)
|
||||||
IHandleCrash();
|
IHandleCrash();
|
||||||
fHandled->Signal(); // Tell CrashCli we handled it
|
fHandled->Signal(); // Tell CrashCli we handled it
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user