C++ Actor Framework 1.0.0
|
Grants read access to the first consumer that calls open
on the resource.
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 | |
consumer_resource (buffer_ptr buf) | |
consumer_resource (consumer_resource &&)=default | |
consumer_resource (const consumer_resource &)=default | |
consumer_resource & | operator= (consumer_resource &&)=default |
consumer_resource & | operator= (const consumer_resource &)=default |
consumer_resource & | operator= (std::nullptr_t) |
buffer_ptr | try_open () |
Tries to open the resource for reading from the buffer. | |
template<class Coordinator > | |
auto | observe_on (Coordinator *ctx) const |
Convenience function for calling ctx->make_observable().from_resource(*this) . | |
void | cancel () |
Calls try_open and on success immediately calls cancel on the buffer. | |
bool | valid () const noexcept |
operator bool () const noexcept | |
bool | operator! () const noexcept |
Friends | |
bool | operator== (const consumer_resource &lhs, const consumer_resource &rhs) |
bool | operator!= (const consumer_resource &lhs, const consumer_resource &rhs) |
Grants read access to the first consumer that calls open
on the resource.
Cancels consumption of items on the buffer if the resources gets destroyed before opening it.
buffer_ptr caf::async::consumer_resource< T >::try_open | ( | ) |
Tries to open the resource for reading from the buffer.
The first open
wins on concurrent access.
nullptr
otherwise.