Mercury Currency Engine
|
#include <unbuffered_channel.hpp>
Public Member Functions | |
unbuffered_channel (const unbuffered_channel< T > &rhs) | |
unbuffered_channel (unbuffered_channel< T > &&rhs) | |
void | construct () const |
construct channel context | |
void * | context () const |
retrieve internal context pointer | |
const std::type_info & | type_info () const |
retrieve type_info | |
void | close () const |
close channel | |
bool | closed () const |
report if channel is closed | |
bool | send (const T &s) const |
blocking send a copy of data through channel | |
bool | send (T &&s) const |
blocking move data through channel | |
bool | recv (T &r) const |
blocking retrieve data from channel | |
result | try_send (const T &s) const |
nonblocking attempt to send a copy of data through channel | |
result | try_send (T &&s) const |
nonblocking attempt to move data through channel | |
result | try_recv (T &r) const |
nonblocking attempt to retrieve data from channel | |
void | assign (const unbuffered_channel< T > &rhs) const |
copy internal context of argument channel | |
void | assign (unbuffered_channel< T > &&rhs) const |
move internal context of argument channel | |
Public Member Functions inherited from mce::base_channel< T > | |
base_channel (const base_channel< T > *rhs_bc) | |
iterator context constructor | |
iterator | begin () const |
iterator to the current beginning of the channel | |
iterator | end () const |
default iterator == end() | |
Public Member Functions inherited from mce::channel_operators< T, unbuffered_channel< T > > | |
channel_operators (unbuffered_channel< T > *rhs_ch) | |
context constructor | |
virtual | ~channel_operators () |
operator bool () const | |
return whether channel has a shared context pointer | |
const unbuffered_channel< T > & | operator= (const unbuffered_channel< T > &rhs) const |
lvalue assign channel context | |
const unbuffered_channel< T > & | operator= (unbuffered_channel< T > &&rhs) const |
rvalue assign channel context | |
bool | operator== (const unbuffered_channel< T > &rhs) const |
lvalue channel context comparison | |
bool | operator== (unbuffered_channel< T > &&rhs) const |
rvalue channel context comparison | |
bool | operator!= (const unbuffered_channel< T > &rhs) const |
lvalue channel context not comparison | |
bool | operator!= (unbuffered_channel< T > &&rhs) const |
rvalue channel context not comparison | |
bool | operator< (const unbuffered_channel< T > &rhs) const |
bool | operator< (unbuffered_channel< T > &&rhs) const |
bool | operator<= (const unbuffered_channel< T > &rhs) const |
bool | operator<= (unbuffered_channel< T > &&rhs) const |
bool | operator> (const unbuffered_channel< T > &rhs) const |
bool | operator> (unbuffered_channel< T > &&rhs) const |
bool | operator>= (const unbuffered_channel< T > &rhs) const |
bool | operator>= (unbuffered_channel< T > &&rhs) const |
Additional Inherited Members | |
Public Types inherited from mce::base_channel< T > | |
typedef T | value_type |
template type for channel | |
Static Public Member Functions inherited from mce::channel_operators< T, unbuffered_channel< T > > | |
static unbuffered_channel< T > | make (As &&... as) |
unbuffered_channels are communication objects between arbitrary code (coroutine or otherwise). They are the easiest (and probably best and safest) methods of coroutine communication. Best practice is to use these to communicate state in place of mutex locking state variables or using condition variables.
Communication over an unbuffered_channel requires both the putter code and the getter code be synchronized before either can progress.