#include <async_request.h>
Public Types | |
using | OpResult = detail::OpResult< T > |
Public Member Functions | |
void | requestUpdate () |
bool | updateRequested () const |
template<typename... Args> | |
bool | tryEmplaceUpdate (Args &&... args) |
OpResult | getUpdate () |
A type for making async requests. Although it is safe to use from multiple producers and consumers, it is primarily intended to be used from single producer, single consumer.
Typically the consumer will request an update of the value from thread 0, and the producer will look whether an update was requested from thread 1. Once the producer determines an update was requested (updateRequested() returns true), it calls tryEmplaceUpdate() to update the underlying data. Then when the consumer on thread 0 next calls getUpdate(), an optional wrapper to the updated data is returned, and the AsyncRequest object is reset (it no longer has valid data, and no update will have yet been requested for the next update).
Definition at line 38 of file async_request.h.
using dispenso::AsyncRequest< T >::OpResult = detail::OpResult<T> |
Definition at line 44 of file async_request.h.
|
inline |
The consumer can attempt to get an update.
Definition at line 90 of file async_request.h.
|
inline |
The consumer can call this to request an update to the underlying data. If request has already been made or fulfilled, this is a no-op.
Definition at line 51 of file async_request.h.
|
inline |
The producer can try to emplace a new T object in response to a request.
args | The arguments to emplace. |
Definition at line 74 of file async_request.h.
|
inline |
The producer can check this to determine if an update is needed.
Definition at line 61 of file async_request.h.