add EventImpl::WaitTimeoutSupported

This commit is contained in:
Glenn Maynard
2006-12-22 10:39:55 +00:00
parent 53b4dc4b7c
commit b97d527d02
4 changed files with 13 additions and 0 deletions
+1
View File
@@ -49,6 +49,7 @@ public:
virtual bool Wait( RageTimer *pTimeout ) = 0;
virtual void Signal() = 0;
virtual void Broadcast() = 0;
virtual bool WaitTimeoutSupported() const = 0;
};
class SemaImpl
@@ -348,12 +348,22 @@ bool EventImpl_Pthreads::Wait( RageTimer *pTimeout )
int iRet = pthread_cond_timedwait( &m_Cond, &m_pParent->mutex, &abstime );
return iRet != ETIMEDOUT;
}
bool EventImpl_Pthreads::WaitTimeoutSupported() const
{
return true;
}
#else
bool EventImpl_Pthreads::Wait( RageTimer *pTimeout )
{
pthread_cond_wait( &m_Cond, &m_pParent->mutex );
return true;
}
bool EventImpl_Pthreads::WaitTimeoutSupported() const
{
return false;
}
#endif
void EventImpl_Pthreads::Signal()
@@ -55,6 +55,7 @@ public:
bool Wait( RageTimer *pTimeout );
void Signal();
void Broadcast();
bool WaitTimeoutSupported() const;
private:
MutexImpl_Pthreads *m_pParent;
@@ -49,6 +49,7 @@ public:
bool Wait( RageTimer *pTimeout );
void Signal();
void Broadcast();
bool WaitTimeoutSupported() const { return true; }
private:
MutexImpl_Win32 *m_pParent;