project64/Source/Common/SyncEvent.cpp

32 lines
485 B
C++
Raw Normal View History

2015-11-06 11:42:27 +00:00
#include "stdafx.h"
#include <windows.h>
2015-11-06 11:42:27 +00:00
SyncEvent::SyncEvent(bool bManualReset)
{
m_Event = CreateEvent(NULL, bManualReset, false, NULL);
2015-11-06 11:42:27 +00:00
}
SyncEvent::~SyncEvent()
{
CloseHandle(m_Event);
}
void SyncEvent::Trigger()
{
SetEvent(m_Event);
}
bool SyncEvent::IsTriggered(int32_t iWaitTime)
{
return (WAIT_OBJECT_0 == WaitForSingleObject(m_Event,iWaitTime));
}
void SyncEvent::Reset()
{
ResetEvent(m_Event);
}
void * SyncEvent::GetHandle()
{
return m_Event;
}