Loading...
Searching...
No Matches
oscr::latest_value< T > Struct Template Reference
Inheritance diagram for oscr::latest_value< T >:
Detailed Description
template<typename T>
struct oscr::latest_value< T >
struct oscr::latest_value< T >
The latest of a series of values, from one writing thread to one reading thread, without allocation or lock: a triple buffer. Values the reader has not taken yet are replaced by newer ones.
The writer fills back() then publish()es it; the reader take()s the latest published value. Slots are built on the thread that builds the mailbox: give a string slot its capacity there, and write at most that much.
Public Member Functions | |
| template<typename F > | |
| void | for_each_slot (F &&f) |
| T & | back () noexcept |
| void | publish () noexcept |
| T * | take () noexcept |
Public Member Functions inherited from oscr::drain_request | |
| bool | request () noexcept |
| void | cancel () noexcept |
| void | clear () noexcept |
| void | park () noexcept |
| Writer's thread: the wake-up could not be sent. | |
| bool | unpark () noexcept |
| Writer's thread: whether a wake-up was parked since the last call. | |
Member Function Documentation
◆ take()
template<typename T >
|
inlinenoexcept |
The latest published value, or nullptr when none was published since the last call. It stays valid until the next call.
The documentation for this struct was generated from the following file:
Public Member Functions inherited from