1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Merge pull request #184 from Hoikas/minidump

Improved Crash Handling
This commit is contained in:
Branan Purvine-Riley
2012-04-15 14:08:20 -07:00
35 changed files with 841 additions and 1597 deletions

View File

@ -157,6 +157,7 @@ public:
hsSemaphore(int initialValue=0, const char* name=nil);
~hsSemaphore();
hsBool TryWait();
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
void Signal();
};

View File

@ -316,6 +316,18 @@ hsSemaphore::~hsSemaphore()
#endif
}
hsBool hsSemaphore::TryWait()
{
#ifdef USE_SEMA
int status = ::sem_trywait(fPSema);
return status != E_AGAIN;
#else
int status = ::pthread_mutex_trylock(&fPMutex);
hsThrowIfOSErr(status);
return status==EBUSY ? false : true;
#endif
}
hsBool hsSemaphore::Wait(hsMilliseconds timeToWait)
{
#ifdef USE_SEMA // SHOULDN'T THIS USE timeToWait??!?!? -rje

View File

@ -170,6 +170,13 @@ hsSemaphore::~hsSemaphore()
::CloseHandle(fSemaH);
}
hsBool hsSemaphore::TryWait()
{
DWORD result = ::WaitForSingleObject(fSemaH, 0);
hsAssert(result != WAIT_ABANDONED, "hsSemaphore -> Abandoned Semaphore");
return result == WAIT_OBJECT_0;
}
hsBool hsSemaphore::Wait(hsMilliseconds timeToWait)
{
if (timeToWait == kPosInfinity32)