#include <WaitableEvent.h>
Public Types | |
| enum class | WaitStatus |
Public Member Functions | |
| ~WaitableEvent ()=default | |
| nonvirtual void | Reset () |
| nonvirtual bool | GetIsSet () const noexcept |
| nonvirtual bool | PeekIsSet () const noexcept |
| nonvirtual void | Set () |
| nonvirtual void | Wait (Time::DurationSeconds timeout=Time::kInfinity) |
| nonvirtual WaitStatus | WaitQuietly (Time::DurationSeconds timeout=Time::kInfinity) |
| nonvirtual void | WaitUntil (Time::TimePointSeconds timeoutAt) |
| nonvirtual WaitStatus | WaitUntilQuietly (Time::TimePointSeconds timeoutAt) |
| nonvirtual void | WaitAndReset (Time::Duration timeout=Time::kInfinity) |
AutoReset Waitable Event (like Windows' CreateEvent (resetType==eManualReset, false)).
Definition at line 88 of file WaitableEvent.h.
|
strong |
Intentionally omit case of spurious wakeup we get from condition variables.
Definition at line 174 of file WaitableEvent.h.
|
default |
| void Stroika::Foundation::Execution::WaitableEvent::Reset | ( | ) |
Set the event to the non-signaled state
Definition at line 51 of file WaitableEvent.inl.
|
noexcept |
This checks if the event is currently in a triggered state. Regardless of the type of event (auto-reset or not) - this does not change the trigger state.
Definition at line 56 of file WaitableEvent.inl.
|
noexcept |
This checks if the event is currently in a triggered state. Regardless of the type of event (auto-reset or not) - this does not change the trigger state.
Because of this - if testing with TSAN (thread sanitizer) - probably best to prefix functions calling this with Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_THREAD
Definition at line 60 of file WaitableEvent.inl.
| void WaitableEvent::Set | ( | ) |
Set the event to the signaled state.
Definition at line 95 of file WaitableEvent.cpp.
| void Stroika::Foundation::Execution::WaitableEvent::Wait | ( | Time::DurationSeconds | timeout = Time::kInfinity | ) |
Simple wait. Can use operator HANDLE() to do fancier waits. timeout can be negative (which triggers an immediate exception).
Throws a timeout (
Definition at line 64 of file WaitableEvent.inl.
| auto Stroika::Foundation::Execution::WaitableEvent::WaitQuietly | ( | Time::DurationSeconds | timeout = Time::kInfinity | ) |
Wait the given period of time, and return true if event occurred (Set called), and false on timeout. This is mostly useful if we want a wait, for advisory purposes (say to avoid races), but don't want an exception as its not an issue to handle specially.
Returns: true (kWaitQuietlySetResult) if event signaled/occurred, and false (kWaitQuietlyTimeoutResult) if timeout
Definition at line 68 of file WaitableEvent.inl.
| void Stroika::Foundation::Execution::WaitableEvent::WaitUntil | ( | Time::TimePointSeconds | timeoutAt | ) |
Throws a timeout (
Definition at line 72 of file WaitableEvent.inl.
| auto Stroika::Foundation::Execution::WaitableEvent::WaitUntilQuietly | ( | Time::TimePointSeconds | timeoutAt | ) |
Returns: true (kWaitQuietlySetResult) if event signaled/occurred, and false (kWaitQuietlyTimeoutResult) if timeout
Note - unlike condition variable - will not return with spurious wakeup. So a return of triggered means it definitely was triggered!
Definition at line 76 of file WaitableEvent.inl.
| void Stroika::Foundation::Execution::WaitableEvent::WaitAndReset | ( | Time::Duration | timeout = Time::kInfinity | ) |
Unclear if this is a good idea. Its a preplacement for 'auto-reset' events in Stroika v2.1.
Definition at line 80 of file WaitableEvent.inl.