allow not timing out on semaphore waits

This commit is contained in:
Glenn Maynard
2004-08-29 22:51:09 +00:00
parent abe10501f7
commit 085f354f8a
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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: