Event class that avoids trips into the kernel when the event has been set previously.
#include <UTEvent.h>
Public Member Functions | |
Event_t (bool initially_set=false, bool allow_timeouts_other_than_zero_or_infinite=false) | |
~Event_t () | |
bool | Wait (int32 timeout_ms=-1) |
void | Set (int release_count=1) |
Definition at line 42 of file UTEvent.h.
Event_t::Event_t | ( | bool | initially_set = false , |
|
bool | allow_timeouts_other_than_zero_or_infinite = false | |||
) |
Event constructor. If a nonzero timeout is specified and it does time out, the atomic addition mechanism used to avoid trips into the kernel would have an unfixable race condition. Therefore, use timeouts other than zero or infinite (-1) only when necessary, and if any other timeout is used, the event must have been constructed to allow that. Using that type of event inevitably degrades its performance.
Event_t::~Event_t | ( | ) |
Event destructor.
bool Event_t::Wait | ( | int32 | timeout_ms = -1 |
) |
Waits for the event to be set, or until the specified timeout has elapsed. Returns true if the event has been set and acquired, false if the timeout elapsed. If timeout_ms is specified to be -1, the function will wait indefinitely.
void Event_t::Set | ( | int | release_count = 1 |
) |
Sets the event, possibly releasing more than one waiting thread depending on release_count.