diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index a1b5b5a0af..2ca06c0766 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -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 ) { diff --git a/stepmania/src/RageThreads.h b/stepmania/src/RageThreads.h index 42bcccb97d..fb0b7588f5 100644 --- a/stepmania/src/RageThreads.h +++ b/stepmania/src/RageThreads.h @@ -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 {