Files
libsst/ZUtil/ZEvent.cpp
2026-04-03 00:22:39 -05:00

35 lines
647 B
C++

#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;
}