Initial commit
This commit is contained in:
34
ZUtil/ZEvent.cpp
Normal file
34
ZUtil/ZEvent.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <ZUtil/ZEvent.hpp>
|
||||
#include <ZUtil/ZAssert.hpp>
|
||||
#include <SST/SST_Concurrency.h> //Need this for SST_WAIT_INFINITE
|
||||
|
||||
ZEvent::ZEvent()
|
||||
: Event(SST_Concurrency_CreateEvent())
|
||||
{
|
||||
ZASSERT_RUNTIME(Event != NULL, "ZEvent failed to allocate event from libsst-concurrency!");
|
||||
}
|
||||
|
||||
ZEvent::~ZEvent()
|
||||
{
|
||||
SST_Concurrency_DestroyEvent(Event);
|
||||
}
|
||||
|
||||
void ZEvent::Notify()
|
||||
{
|
||||
SST_Concurrency_SignalEvent(Event);
|
||||
}
|
||||
|
||||
void ZEvent::Reset()
|
||||
{
|
||||
SST_Concurrency_ResetEvent(Event);
|
||||
}
|
||||
|
||||
bool ZEvent::Wait()
|
||||
{
|
||||
return SST_Concurrency_WaitEvent(Event, SST_WAIT_INFINITE) != 0;
|
||||
}
|
||||
|
||||
bool ZEvent::Wait( uint32_t _ms )
|
||||
{
|
||||
return SST_Concurrency_WaitEvent(Event, _ms) != 0;
|
||||
}
|
||||
Reference in New Issue
Block a user