Class channel_peeker¶
template <typename T typename T, typename M typename M>
Extension of channel_reader for subroutines.More...
#include <channel.hpp>
Inherits the following classes: channel_reader
Public Types inherited from channel_reader¶
See channel_reader
| Type | Name |
|---|---|
| typedef channel< T, M > | channel_type |
| typedef T * | pointer |
| typedef T & | reference |
| typedef T | value_type |
Public Attributes inherited from channel_reader¶
See channel_reader
| Type | Name |
|---|---|
| channel_type * | chan Next reader in channel. |
| channel_reader * | next = = nullptr |
Public Functions¶
| Type | Name |
|---|---|
| bool | acquire (T & storage) noexcept Move a value from matches writer to designated storage. After then, resume thewriter coroutine. |
| channel_peeker (channel_type & ch) noexcept |
|
| void | peek () noexcept const Since there is no suspension for the peeker , the implementation will use scoped locking. |
Public Functions inherited from channel_reader¶
See channel_reader
| Type | Name |
|---|---|
| bool | await_ready () noexcept const Lock the channel and find available channel_writer __ |
| auto | await_resume () noexcept Returns value from writer coroutine, and bool indicator for the associtated channel's destruction. |
| void | await_suspend (coroutine_handle< void > coro) noexcept Push to the channel and wait for channel_writer . |
| ~channel_reader () noexcept |
Protected Attributes inherited from channel_reader¶
See channel_reader
| Type | Name |
|---|---|
| union channel_reader::@0 | @1 Resumeable Handle. |
| void * | frame Address of value. |
| pointer | ptr |
Protected Functions inherited from channel_reader¶
See channel_reader
| Type | Name |
|---|---|
| channel_reader (channel_type & ch) noexcept |
|
| channel_reader (const channel_reader &) noexcept |
|
| channel_reader (channel_reader &&) noexcept |
|
| channel_reader & | operator= (const channel_reader &) noexcept |
| channel_reader & | operator= (channel_reader &&) noexcept |
Detailed Description¶
Template parameters:
Ttype of the elementMmutex for the channel
See also: channel_reader
Public Functions Documentation¶
function acquire¶
inline bool channel_peeker::acquire (
T & storage
) noexcept
Note:
Unless the caller has invoked peek, nothing will happen.
bool peek_channel(channel<string>& ch, string& out){
peeker p{ch};
p.peek();
return p.acquire(out);
}
Parameters:
storagememory object to store the value fromwriter
Returns:
true Acquired the value
Returns:
false No writer found or peek is not invoked
See also: peek
function channel_peeker [3/3]¶
inline explicit channel_peeker::channel_peeker (
channel_type & ch
) noexcept
function peek¶
inline void channel_peeker::peek () noexcept const
The documentation for this class was generated from the following file interface/coroutine/channel.hpp