diff --git a/Source/Common/SyncEvent.cpp b/Source/Common/SyncEvent.cpp index 5241a086e..77f7eb353 100644 --- a/Source/Common/SyncEvent.cpp +++ b/Source/Common/SyncEvent.cpp @@ -9,9 +9,9 @@ SyncEvent::SyncEvent(bool bManualReset) m_Event = CreateEvent(NULL, bManualReset, FALSE, NULL); #else m_signalled = false; - m_Event = new pthread_mutex_t; + m_Event = new pthread_mutex_t; m_cond = new pthread_cond_t; - pthread_mutex_init((pthread_mutex_t*)m_Event,NULL); + pthread_mutex_init((pthread_mutex_t*)m_Event, NULL); pthread_cond_init((pthread_cond_t*)m_cond, NULL); #endif } @@ -21,7 +21,7 @@ SyncEvent::~SyncEvent() #ifdef _WIN32 CloseHandle(m_Event); #else - pthread_mutex_destroy((pthread_mutex_t*)m_Event); + pthread_mutex_destroy((pthread_mutex_t*)m_Event); pthread_cond_destroy((pthread_cond_t*)m_cond); delete (pthread_mutex_t*)m_Event; delete (pthread_cond_t*)m_cond; @@ -31,7 +31,7 @@ SyncEvent::~SyncEvent() void SyncEvent::Trigger() { #ifdef _WIN32 - SetEvent(m_Event); + SetEvent(m_Event); #else pthread_mutex_lock((pthread_mutex_t*)m_Event); m_signalled = true; @@ -43,15 +43,15 @@ void SyncEvent::Trigger() bool SyncEvent::IsTriggered(int32_t iWaitTime) { #ifdef _WIN32 - return (WAIT_OBJECT_0 == WaitForSingleObject(m_Event,iWaitTime)); + return (WAIT_OBJECT_0 == WaitForSingleObject(m_Event, iWaitTime)); #else pthread_mutex_lock((pthread_mutex_t*)m_Event); while (!m_signalled) { pthread_cond_wait((pthread_cond_t*)m_cond, (pthread_mutex_t*)m_Event); } - m_signalled = false; pthread_mutex_unlock((pthread_mutex_t*)m_Event); + Reset(); return true; #endif } @@ -59,11 +59,11 @@ bool SyncEvent::IsTriggered(int32_t iWaitTime) void SyncEvent::Reset() { #ifdef _WIN32 - ResetEvent(m_Event); + ResetEvent(m_Event); #else -#ifdef tofix - pthread_mutex_unlock(&evt.m_mutex); -#endif + pthread_mutex_lock((pthread_mutex_t*)m_Event); + m_signalled = false; + pthread_mutex_unlock((pthread_mutex_t*)m_Event); #endif }