1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-22 17:48:01 +02:00
Beef/BeefLibs/corlib/src/Threading/Event.bf

36 lines
671 B
Beef
Raw Normal View History

2019-08-23 11:56:54 -07:00
namespace System.Threading
{
public class WaitEvent
{
Platform.BfpEvent* mEvent;
public this(bool initiallySet = false)
{
Platform.BfpEventFlags flags = .AllowAutoReset | .AllowManualReset;
if (initiallySet)
flags |= .InitiallySet_Manual;
mEvent = Platform.BfpEvent_Create(flags);
}
public ~this()
{
Platform.BfpEvent_Release(mEvent);
}
public void Set(bool requireManualReset = false)
{
Platform.BfpEvent_Set(mEvent, requireManualReset);
}
public void Reset()
{
Platform.BfpEvent_Reset(mEvent, null);
}
public bool WaitFor(int waitMS = -1)
{
return Platform.BfpEvent_WaitFor(mEvent, (int32)waitMS);
}
}
}