2015-11-06 11:42:27 +00:00
|
|
|
#include "stdafx.h"
|
2016-01-05 10:32:18 +00:00
|
|
|
#include <windows.h>
|
2015-11-06 11:42:27 +00:00
|
|
|
|
|
|
|
SyncEvent::SyncEvent(bool bManualReset)
|
|
|
|
{
|
2016-01-05 10:32:18 +00:00
|
|
|
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;
|
|
|
|
}
|