The TimedThreadNotification is a synchronization primitive that can be used to permit a SINGLE thread to block and consume a latching, saturating notification from multiple notifiers.
This is effectively a subset of a binary semaphore API, except that only a single thread can be notified and block at a time.
The single consumer aspect of the API permits the use of a smaller and/or faster native APIs such as direct thread signaling.
The TimedThreadNotification is initialized to being empty (latch is not set).
Public Member Functions | |
| TimedThreadNotification (const TimedThreadNotification &)=delete | |
| TimedThreadNotification (TimedThreadNotification &&)=delete | |
| TimedThreadNotification & | operator= (const TimedThreadNotification &)=delete |
| TimedThreadNotification & | operator= (TimedThreadNotification &&)=delete |
| bool | try_acquire_for (chrono::SystemClock::duration timeout) |
| bool | try_acquire_until (chrono::SystemClock::time_point deadline) |
Public Member Functions inherited from pw::sync::ThreadNotification | |
| ThreadNotification (const ThreadNotification &)=delete | |
| ThreadNotification (ThreadNotification &&)=delete | |
| ThreadNotification & | operator= (const ThreadNotification &)=delete |
| ThreadNotification & | operator= (ThreadNotification &&)=delete |
| void | acquire () |
| bool | try_acquire () |
| void | release () |
| native_handle_type | native_handle () |
Additional Inherited Members | |
Public Types inherited from pw::sync::ThreadNotification | |
| using | native_handle_type = backend::NativeThreadNotificationHandle |
| bool pw::sync::TimedThreadNotification::try_acquire_for | ( | chrono::SystemClock::duration | timeout | ) |
Blocks until the specified timeout duration has elapsed or the thread has been notified (i.e. notification latch can be cleared because it was set), whichever comes first.
Clears the notification latch.
true if the thread was notified, meaning the internal latch was reset successfully.| bool pw::sync::TimedThreadNotification::try_acquire_until | ( | chrono::SystemClock::time_point | deadline | ) |
Blocks until the specified deadline time has been reached the thread has been notified (i.e. notification latch can be cleared because it was set), whichever comes first.
Clears the notification latch.
true if the thread was notified, meaning the internal latch was reset successfully.