Programming Reference:WaitableEvent Class
Location
BCI2000/src/shared/utils/Lib
Synopsis
The WaitableEvent class provides a mechanism to synchronize threads by waiting for another thread to signal the WaitableEvent. The underlying functionality corresponds to a manual-reset event in Windows.
Methods
WaitableEvent()
Events are created in non-signaled state.
~WaitableEvent()
Releases all resources allocated for the event object.
bool Set()
Sets the event to signaled state. When one or more threads are blocked waiting for the event, they are released in random order. As long as the event is in signaled state, threads calling its Wait() function will not be blocked. Returns true when successful, false otherwise.
bool Reset()
Resets the event to non-signaled state. Call Reset() immediately after Wait() to emulate the behavior of a Windows auto-reset event. Returns true when successful, false otherwise.
bool Wait([TimeInterval timeout])
Waits for the event to become signaled. Does nothing when the event is currently in signaled state. When a timeout is specified, waits no longer than the specified amount of time. Returns true when the event is signaled, and false otherwise (error or timeout occurred).