|
Uni20
Asynchronous tensor and runtime library.
|
RAII handle representing the writer of a value in an EpochContext. More...
#include <epoch_context.hpp>
Public Member Functions | |
| T const & | data () const |
| Access the stored value inside the parent Async<T>. | |
| T const * | data_maybe () const |
| std::optional< T > | data_option () const |
| Optionally retrieves the value stored in this buffer, if available. | |
| std::shared_ptr< EpochContext > | epoch_context_shared () const noexcept |
| EpochContextReader ()=delete | |
| Default-constructed inactive reader (no effect). | |
| EpochContextReader (EpochContextReader &&other) noexcept | |
| Move constructor. | |
| EpochContextReader (EpochContextReader const &other) | |
| Copy constructor retaining the reader reference count. | |
| EpochContextReader (shared_storage< T > storage, std::shared_ptr< EpochContext > epoch) noexcept | |
| Construct a new reader handle for a given parent and epoch. | |
| T const & | get_wait () const |
| Wait for the epoch to become available on the global scheduler and return a reference to the value. | |
| T const & | get_wait (IAsyncScheduler &sched) const |
| Wait for the epoch to become available on the provided scheduler and return a reference to the value. | |
| void | notify_when_ready (std::function< void()> notify) const |
| Register a callback for this reader becoming ready. | |
| EpochContextReader & | operator= (EpochContextReader &&other) noexcept |
| Move assignment. | |
| EpochContextReader & | operator= (EpochContextReader const &other) |
| Copy assignment retaining the reader reference count. | |
| bool | ready () const noexcept |
| Check whether the reader is ready to resume. | |
| void | release () noexcept |
| Release the reader. | |
| void | suspend (BasicTask &&t) |
| Suspend a coroutine task as a reader of this epoch. | |
| void | wait () const |
| Wait for the epoch to become available on the global scheduler. | |
| void | wait (IAsyncScheduler &sched) const |
| Wait for the epoch to become available on the provided scheduler. | |
| ~EpochContextReader () | |
| Destructor. Signals epoch reader completion if still active. | |
RAII handle representing the writer of a value in an EpochContext.
On construction, this marks the epoch as having a writer. When the buffer is set and the writer releases the value, waiting readers may resume.
EpochContextWriter does not represent a coroutine or suspendable operation. It is a scoped object used to enforce single-writer discipline and ensure writer→readers sequencing.
.release() to trigger reader advancement.
|
delete |
Default-constructed inactive reader (no effect).
|
inline |
Copy constructor retaining the reader reference count.
|
inlinenoexcept |
Construct a new reader handle for a given parent and epoch.
| value | Shared pointer to the stored value. |
| epoch | Pointer to the epoch being tracked. |
|
inlinenoexcept |
Move constructor.
Transfers ownership and nulls the source.
| other | Reader being moved from. |
|
inline |
Destructor. Signals epoch reader completion if still active.
|
inline |
Access the stored value inside the parent Async<T>.
| buffer_read_uninitialized | if no value was constructed for this epoch. |
|
inline |
| Any | exception stored in the writer, if the buffer is in an exception state. |
|
inline |
Optionally retrieves the value stored in this buffer, if available.
std::nullopt if the buffer was cancelled. | Any | exception stored in the writer, if the write failed exceptionally. |
|
inlinenoexcept |
| T const & uni20::async::EpochContextReader< T >::get_wait | ( | ) | const |
Wait for the epoch to become available on the global scheduler and return a reference to the value.
Wait for a reader context using the global scheduler.
| T | Stored value type. |
| T const & uni20::async::EpochContextReader< T >::get_wait | ( | IAsyncScheduler & | sched | ) | const |
Wait for the epoch to become available on the provided scheduler and return a reference to the value.
Wait for a reader context using an explicit scheduler.
| sched | Scheduler used to drive readiness. |
| T | Stored value type. |
| sched | Scheduler used to drive progress. |
|
inline |
Register a callback for this reader becoming ready.
| notify | Non-throwing callback invoked when the epoch reaches Reading. |
|
inlinenoexcept |
Move assignment.
Releases prior ownership and transfers.
| other | Reader being moved from. |
|
inline |
Copy assignment retaining the reader reference count.
| other | Reader being copied from. |
|
inlinenoexcept |
Check whether the reader is ready to resume.
|
inlinenoexcept |
Release the reader.
|
inline |
Suspend a coroutine task as a reader of this epoch.
| t | The coroutine task to register. |
| void uni20::async::EpochContextReader< T >::wait | ( | ) | const |
Wait for the epoch to become available on the global scheduler.
Wait for a reader context using the global scheduler.
| T | Stored value type. |
| void uni20::async::EpochContextReader< T >::wait | ( | IAsyncScheduler & | sched | ) | const |
Wait for the epoch to become available on the provided scheduler.
Wait for a reader context using an explicit scheduler.
| sched | Scheduler used to drive readiness. |
| T | Stored value type. |
| sched | Scheduler used to drive progress. |