allow not timing out on semaphore waits
This commit is contained in:
@@ -661,13 +661,13 @@ void RageSemaphore::Post()
|
|||||||
m_pSema->Post();
|
m_pSema->Post();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSemaphore::Wait()
|
void RageSemaphore::Wait( bool bFailOnTimeout )
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
if( m_pSema->Wait() )
|
if( m_pSema->Wait() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Dialog::IsShowingDialog() )
|
if( !bFailOnTimeout || Dialog::IsShowingDialog() )
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
/* We waited too long. We're probably deadlocked, though unlike mutexes, we can't
|
/* We waited too long. We're probably deadlocked, though unlike mutexes, we can't
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public:
|
|||||||
CString GetName() const { return m_sName; }
|
CString GetName() const { return m_sName; }
|
||||||
int GetValue() const;
|
int GetValue() const;
|
||||||
void Post();
|
void Post();
|
||||||
void Wait();
|
void Wait( bool bFailOnTimeout=true );
|
||||||
bool TryWait();
|
bool TryWait();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user