Class channel_writer¶
template <typename T typename T, typename M typename M>
Awaitable for channel 's write operation. It exposes a reference to the value forchannel_reader .More...
#include <channel.hpp>
Public Types¶
| Type | Name |
|---|---|
| typedef channel< T, M > | channel_type |
| typedef T * | pointer |
| typedef T & | reference |
| typedef T | value_type |
Public Attributes¶
| Type | Name |
|---|---|
| channel_type * | chan Next writer in channel. |
| channel_writer * | next = = nullptr |
Public Functions¶
| Type | Name |
|---|---|
| bool | await_ready () noexcept const Lock the channel and find available channel_reader __ |
| bool | await_resume () noexcept Returns bool indicator for the associtated channel's destruction. |
| void | await_suspend (coroutine_handle< void > coro) noexcept Push to the channel and wait for channel_reader . |
| ~channel_writer () noexcept |
Detailed Description¶
void write_to(channel<int>& ch, int value) {
bool ok = co_await ch.write(value);
if(ok == false)
; // channel is under destruction !!!
}
Template parameters:
Ttype of the elementMmutex for the channel
See also: channel_reader
Public Types Documentation¶
typedef channel_type [1/2]¶
using channel_writer< T, M >::channel_type = channel<T, M>;
typedef pointer¶
using channel_writer< T, M >::pointer = T*;
typedef reference¶
using channel_writer< T, M >::reference = T&;
typedef value_type¶
using channel_writer< T, M >::value_type = T;
Public Attributes Documentation¶
variable chan¶
channel_type* channel_writer< T, M >::chan;
variable next¶
channel_writer* channel_writer< T, M >::next;
Public Functions Documentation¶
function await_ready¶
inline bool channel_writer::await_ready () noexcept const
Returns:
true Matched with channel_reader
Returns:
false There was no available channel_reader. The channel will be **lock**ed for this case.
function await_resume¶
inline bool channel_writer::await_resume () noexcept
Returns:
true successfully sent the value to channel_reader
Returns:
false The channel is under destruction
function await_suspend¶
inline void channel_writer::await_suspend (
coroutine_handle < void > coro
) noexcept
Note:
The channel will be **unlock**ed after return.
Parameters:
coroRemember current coroutine's handle to resume later
See also: await_ready
function ~channel_writer¶
channel_writer::~channel_writer () noexcept
The documentation for this class was generated from the following file interface/coroutine/channel.hpp