C++ Actor Framework 1.0.0
|
Grants access to a buffer to the first producer that calls open
.
More...
#include <spsc_buffer.hpp>
Public Types | |
using | value_type = T |
using | buffer_type = spsc_buffer<T> |
using | buffer_ptr = spsc_buffer_ptr<T> |
Public Member Functions | |
producer_resource (buffer_ptr buf) | |
producer_resource (producer_resource &&)=default | |
producer_resource (const producer_resource &)=default | |
producer_resource & | operator= (producer_resource &&)=default |
producer_resource & | operator= (const producer_resource &)=default |
producer_resource & | operator= (std::nullptr_t) |
buffer_ptr | try_open () |
Tries to open the resource for writing to the buffer. | |
void | close () |
Calls try_open and on success immediately calls close on the buffer. | |
void | abort (error reason) |
Calls try_open and on success immediately calls abort on the buffer. | |
bool | valid () const noexcept |
operator bool () const noexcept | |
bool | operator! () const noexcept |
Friends | |
bool | operator== (const producer_resource &lhs, const producer_resource &rhs) |
bool | operator!= (const producer_resource &lhs, const producer_resource &rhs) |
Grants access to a buffer to the first producer that calls open
.
Aborts writes on the buffer if the resources gets destroyed before opening it.
buffer_ptr caf::async::producer_resource< T >::try_open | ( | ) |
Tries to open the resource for writing to the buffer.
The first open
wins on concurrent access.
nullptr
otherwise.