LLFIO  v2.00
llfio_v2_xxx::byte_io_multiplexer::awaitable< T > Struct Template Referencefinal

A convenience coroutine awaitable type returned by .co_read(), .co_write() and .co_barrier(). Blocks execution if no i/o multiplexer has been set on this handle! More...

#include "byte_io_multiplexer.hpp"

Inheritance diagram for llfio_v2_xxx::byte_io_multiplexer::awaitable< T >:
llfio_v2_xxx::byte_io_multiplexer::io_operation_state_visitor

Public Types

using result_type = T
 The result type of this awaitable.
 
using buffers_type = typename result_type::value_type
 The buffers type of this awaitable.
 

Public Member Functions

constexpr awaitable ()
 Default constructor.
 
 awaitable (result_type &&res) noexcept
 Constructs an immediately finished awaitable.
 
 awaitable (const awaitable &)=delete
 
 awaitable (awaitable &&o) noexcept
 Move construction, terminates the process if the i/o is in progress.
 
awaitableoperator= (const awaitable &)=delete
 
awaitableoperator= (awaitable &&o) noexcept
 
 ~awaitable ()
 Destructor, blocks if the i/o is in progress.
 
bool await_ready () noexcept
 True if the i/o state is finished. Begins the i/o if it is not initiated yet.
 
result_type await_resume ()
 Returns the result of the i/o.
 

Public Attributes

byte _state_storage [_state_storage_bytes]
 
io_operation_state_state {nullptr}
 

Static Public Attributes

static constexpr size_t _state_storage_bytes = _awaitable_size - sizeof(void *) - sizeof(io_operation_state *)
 

Protected Types

using lock_guard = io_operation_state::lock_guard
 

Protected Member Functions

void set_state (io_operation_state *state) noexcept
 
virtual void read_finished (lock_guard &g, io_operation_state_type) override
 Called when an i/o has finished, and its state can now be destroyed.
 
virtual void write_or_barrier_finished (lock_guard &g, io_operation_state_type) override
 Called when an i/o has finished, and its state can now be destroyed.
 
virtual void read_initiated (lock_guard &, io_operation_state_type)
 Called when an i/o has been initiated, and is now being processed asynchronously.
 
virtual bool read_completed (lock_guard &, io_operation_state_type, io_result< buffers_type > &&)
 Called when an i/o has completed, and its result is available. Return true if you consume the result.
 
virtual void write_initiated (lock_guard &, io_operation_state_type)
 Called when an i/o has been initiated, and is now being processed asynchronously.
 
virtual bool write_completed (lock_guard &, io_operation_state_type, io_result< const_buffers_type > &&)
 Called when an i/o has completed, and its result is available. Return true if you consume the result.
 
virtual void barrier_initiated (lock_guard &, io_operation_state_type)
 Called when an i/o has been initiated, and is now being processed asynchronously.
 
virtual bool barrier_completed (lock_guard &, io_operation_state_type, io_result< const_buffers_type > &&)
 Called when an i/o has completed, and its result is available. Return true if you consume the result.
 

Friends

class byte_io_handle
 
class byte_socket_handle
 
class listening_byte_socket_handle
 

Detailed Description

template<class T>
struct llfio_v2_xxx::byte_io_multiplexer::awaitable< T >

A convenience coroutine awaitable type returned by .co_read(), .co_write() and .co_barrier(). Blocks execution if no i/o multiplexer has been set on this handle!

Upon first .await_ready(), the awaitable initiates the i/o. If the i/o completes immediately, the awaitable is immediately ready and no coroutine suspension occurs.

If the i/o does not complete immediately, the coroutine is suspended. To cause resumption of execution, you will need to pump the associated i/o multiplexer for completions using byte_io_multiplexer::check_for_any_completed_io().


The documentation for this struct was generated from the following files: