|
Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
|
#include <channel.hpp>
Public Member Functions | |
| Channel (std::size_t capacity=std::size_t(-1)) | |
| Channel (const Channel &)=delete | |
| Channel & | operator= (const Channel &)=delete |
| Channel (Channel &&)=delete | |
| Channel & | operator= (Channel &&)=delete |
| ~Channel () | |
| Releases every still-parked sender / receiver. | |
| auto | send (T value) |
| auto | recv () |
| void | close () |
| Mark the channel closed and release EVERY parked coroutine. | |
| bool | is_closed () const |
| std::size_t | size () const |
|
inlineexplicit |
|
delete |
|
delete |
|
inline |
Releases every still-parked sender / receiver.
Destroying a channel that still has waiters would otherwise leak one coroutine frame per waiter: nothing else holds those handles, so they could never be resumed or destroyed. close() is idempotent and resumes outside the lock, so calling it here is safe even when the user already closed the channel explicitly.
NOTE: the resumed coroutines run during this destructor. They must not start another operation on the channel. A receiver's await_resume only uses its own delivery slot, so completing a parked receive does not access the channel again.
|
delete |
|
delete |
|
inline |
|
inline |
|
inline |
Mark the channel closed and release EVERY parked coroutine.
Still-parked receivers observe an empty optional (end of stream). Values already buffered or assigned to a receiver are not discarded. Senders parked on a full buffer are woken too and their pending values are dropped — matching send()'s own "channel already closed → drop the value and continue" behaviour. Waking only the receivers (the original implementation) left every blocked sender suspended forever, leaking one coroutine frame each and hanging any producer that was waiting for buffer space at close time.
|
inlinenodiscard |
|
inlinenodiscard |