Audacity 3.2.0
|
Communicate data atomically from one writer thread to one reader. More...
#include <MessageBuffer.h>
Classes | |
struct | UpdateSlot |
Public Member Functions | |
void | Initialize () |
template<typename Result = Data, typename... ConstructorArgs> | |
Result | Read (ConstructorArgs &&...args) |
Move data out (if available), or else copy it out. More... | |
template<typename Arg = Data&&> | |
void | Write (Arg &&arg) |
Reassign a slot by move or copy. More... | |
Private Attributes | |
NonInterfering< UpdateSlot > | mSlots [2] |
std::atomic< unsigned char > | mLastWrittenSlot { 0 } |
Communicate data atomically from one writer thread to one reader.
This is not a queue: it is not necessary for each write to be read. Rather loss of a message is allowed: writer may overwrite. Data must be default-constructible and reassignable.
Definition at line 23 of file MessageBuffer.h.
void MessageBuffer< Data >::Initialize |
Definition at line 47 of file MessageBuffer.h.
Result MessageBuffer< Data >::Read | ( | ConstructorArgs &&... | args | ) |
Move data out (if available), or else copy it out.
Result | is constructible from Data&& and forwards of other arguments |
Definition at line 64 of file MessageBuffer.h.
Reassign a slot by move or copy.
Definition at line 88 of file MessageBuffer.h.
|
private |
Definition at line 30 of file MessageBuffer.h.
|
private |
Definition at line 28 of file MessageBuffer.h.