![]() |
Home | Libraries | People | FAQ | More |
boost::lockfree::spsc_value
// In header: <boost/lockfree/spsc_value.hpp> template<typename T, Options> struct spsc_value { // public member functions (); (); (); (); (); (); template<typename Functor> (); };
The spcs_value provides a single-writer/single-reader value, implemented by a triple buffer
Policies:
boost::lockfree::allow_multiple_reads, defaults to boost::lockfree::allow_multiple_reads<false>
If multiple reads are allowed, a value written to the spsc_value can be read multiple times, but not moved out of the instance. If multiple reads are not allowed, the class works as single-element queue that overwrites on write
spsc_value
public member functions();
Construct a spsc_value
If configured with boost::lockfree::allow_multiple_reads<true> it is initialized to a default-constructed value
( value);
Construct a spsc_value, initialized to a value
( value);
Writes value
to the spsc_value
![]() |
Note |
---|---|
Thread-safe and wait-free |
Requires: |
only one thread is allowed to write data to the spsc_value |
Postconditions: |
object will be written to the spsc_value |
( value);
Writes value
to the spsc_value
![]() |
Note |
---|---|
Thread-safe and wait-free |
Requires: |
only one thread is allowed to write data to the spsc_value |
Postconditions: |
object will be written to the spsc_value |
( ret);
Reads content of the spsc_value
![]() |
Note |
---|---|
Thread-safe and wait-free |
Requires: |
only one thread is allowed to write data to the spsc_value |
Postconditions: |
if read operation is successful, object will be copied to |
Returns: |
|
();
Reads content of the spsc_value, returning an optional
![]() |
Note |
---|---|
Thread-safe and wait-free |
Requires: |
only one thread is allowed to write data to the spsc_value |
Returns: |
|
template<typename Functor> ( f);
consumes value via a functor
reads element from the spsc_value and applies the functor on this object
![]() |
Note |
---|---|
Thread-safe and non-blocking, if functor is thread-safe and non-blocking |
Returns: |
|