RageEvent

This commit is contained in:
Glenn Maynard
2004-11-07 23:21:45 +00:00
parent 0330fa9e87
commit 6eb08e4140
2 changed files with 45 additions and 1 deletions
+29
View File
@@ -653,6 +653,35 @@ void LockMutex::Unlock()
}
}
RageEvent::RageEvent( CString name ):
RageMutex(name)
{
m_pEvent = MakeEvent( m_pMutex );
}
RageEvent::~RageEvent()
{
delete m_pEvent;
}
void RageEvent::Wait()
{
ASSERT( IsLockedByThisThread() );
m_pEvent->Wait();
}
void RageEvent::Signal()
{
ASSERT( IsLockedByThisThread() );
m_pEvent->Signal();
}
void RageEvent::Broadcast()
{
ASSERT( IsLockedByThisThread() );
m_pEvent->Broadcast();
}
RageSemaphore::RageSemaphore( CString sName, int iInitialValue ):
m_sName( sName )
{
+16 -1
View File
@@ -68,7 +68,7 @@ public:
RageMutex( CString name );
virtual ~RageMutex();
private:
protected:
MutexImpl *m_pMutex;
CString m_sName;
@@ -130,6 +130,21 @@ public:
#define LockMut(m) LockMutex LocalLock(m, __FUNCTION__, __LINE__)
#endif
class EventImpl;
class RageEvent: public RageMutex
{
public:
RageEvent( CString name );
~RageEvent();
void Wait();
void Signal();
void Broadcast();
private:
EventImpl *m_pEvent;
};
class SemaImpl;
class RageSemaphore
{