MySQL 8.0.40
Source Code Documentation
|
#include <io_context.h>
Classes | |
class | async_op |
base class of async operation. More... | |
class | async_op_impl |
async operation with callback. More... | |
class | AsyncOps |
class | DeferredWork |
queued work from io_context::executor_type::dispatch()/post()/defer(). More... | |
class | executor_type |
class | monitor |
class | timer_queue |
class | timer_queue_base |
Public Types | |
using | count_type = size_t |
using | native_handle_type = impl::socket::native_handle_type |
Public Member Functions | |
io_context () | |
io_context (std::unique_ptr< net::impl::socket::SocketServiceBase > &&socket_service, std::unique_ptr< IoServiceBase > &&io_service) | |
io_context (int) | |
~io_context () | |
io_context (const io_context &)=delete | |
io_context & | operator= (const io_context &)=delete |
executor_type | get_executor () noexcept |
count_type | run () |
template<class Rep , class Period > | |
count_type | run_for (const std::chrono::duration< Rep, Period > &rel_time) |
template<class Clock , class Duration > | |
count_type | run_until (const std::chrono::time_point< Clock, Duration > &abs_time) |
count_type | run_one () |
template<class Rep , class Period > | |
count_type | run_one_for (const std::chrono::duration< Rep, Period > &rel_time) |
template<class Clock , class Duration > | |
count_type | run_one_until (const std::chrono::time_point< Clock, Duration > &abs_time) |
count_type | poll () |
count_type | poll_one () |
void | stop () |
bool | stopped () const noexcept |
void | restart () |
impl::socket::SocketServiceBase * | socket_service () const |
IoServiceBase * | io_service () const |
stdx::expected< void, std::error_code > | open_res () const noexcept |
get the status of the implicit open() call of the io-service. More... | |
Public Member Functions inherited from net::execution_context | |
execution_context ()=default | |
execution_context (const execution_context &)=delete | |
execution_context & | operator= (const execution_context &)=delete |
virtual | ~execution_context () |
void | notify_fork (fork_event e) |
Private Member Functions | |
template<class Func , class ProtoAllocator > | |
void | defer_work (Func &&f, const ProtoAllocator &a) |
defer work for later execution. More... | |
template<class Clock , class Duration > | |
count_type | do_one_until (std::unique_lock< std::mutex > &lk, const std::chrono::time_point< Clock, Duration > &abs_time) |
count_type | do_one (std::unique_lock< std::mutex > &lk, std::chrono::milliseconds timeout) |
bool | has_outstanding_work () const |
stdx::expected< void, std::error_code > | cancel (native_handle_type fd) |
cancel all async-ops of a file-descriptor. More... | |
template<class Op > | |
void | async_wait (native_handle_type fd, impl::socket::wait_type wt, Op &&op) |
template<class Timer , class Op > | |
void | async_wait (const Timer &timer, Op &&op) |
async wait for a timer expire. More... | |
template<class Timer > | |
size_t | cancel (const Timer &timer) |
cancel all async-ops of a timer. More... | |
template<class Timer > | |
size_t | cancel_one (const Timer &) |
void | wait_no_runner_ (std::unique_lock< std::mutex > &lk) |
void | wait_no_runner_unlocked_ (std::unique_lock< std::mutex > &lk) |
void | wake_one_runner_ (std::unique_lock< std::mutex > &lk) |
void | is_running (bool v) |
bool | is_running () const |
void | notify_io_service_if_not_running_in_this_thread () |
Private Attributes | |
DeferredWork | deferred_work_ |
bool | stopped_ {false} |
std::atomic< count_type > | work_count_ {} |
std::unique_ptr< impl::socket::SocketServiceBase > | socket_service_ |
std::unique_ptr< IoServiceBase > | io_service_ |
stdx::expected< void, std::error_code > | io_service_open_res_ |
AsyncOps | active_ops_ |
std::list< std::unique_ptr< async_op > > | cancelled_ops_ |
std::vector< timer_queue_base * > | timer_queues_ |
pointers to the timer-queues of this io-contexts. More... | |
std::mutex | mtx_ {} |
mutex that protects the core parts of the io-context. More... | |
std::mutex | do_one_mtx_ {} |
std::condition_variable | do_one_cond_ {} |
bool | is_running_ {false} |
Friends | |
template<typename _Clock , typename _WaitTraits > | |
class | basic_waitable_timer |
class | basic_socket_impl_base |
template<class Protocol > | |
class | basic_socket_impl |
template<class Protocol > | |
class | basic_socket |
template<class Protocol > | |
class | basic_stream_socket |
template<class Protocol > | |
class | basic_socket_acceptor |
Additional Inherited Members | |
Protected Types inherited from net::execution_context | |
using | service_key_type = std::type_index |
Protected Member Functions inherited from net::execution_context | |
void | shutdown () noexcept |
void | destroy () noexcept |
template<typename Service , class... Args> | |
service * | add_service (Args &&...args) |
Static Protected Member Functions inherited from net::execution_context | |
template<class Service > | |
static void | service_deleter (service *svc) |
template<class Key > | |
static service_key_type | service_key () |
maps selected type to unique identifier. More... | |
Protected Attributes inherited from net::execution_context | |
std::mutex | services_mtx_ |
std::list< ServicePtr > | services_ |
std::unordered_map< service_key_type, service * > | keys_ |
using net::io_context::count_type = size_t |
|
inline |
|
inline |
|
inlineexplicit |
|
inline |
|
delete |
|
inlineprivate |
async wait for a timer expire.
adds the op and timer to the timer_queue
timer | timer |
op | completion handler to call when timer is triggered |
|
inlineprivate |
|
inlineprivate |
cancel all async-ops of a timer.
|
inlineprivate |
cancel all async-ops of a file-descriptor.
|
inlineprivate |
|
inlineprivate |
defer work for later execution.
|
inlineprivate |
|
inlineprivate |
|
inlinenoexcept |
|
inlineprivate |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlinenoexcept |
get the status of the implicit open() call of the io-service.
the io_service_.open() may fail due to out-of-file-descriptors.
run() will fail silently if the io-service failed to open.
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |
io_context::count_type net::io_context::run_for | ( | const std::chrono::duration< Rep, Period > & | rel_time | ) |
|
inline |
|
inline |
|
inline |
io_context::count_type net::io_context::run_until | ( | const std::chrono::time_point< Clock, Duration > & | abs_time | ) |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
mutableprivate |
mutex that protects the core parts of the io-context.
|
private |
|
private |
|
private |
pointers to the timer-queues of this io-contexts.
timer-queues are one per timer-type (std::chrono::steady_clock, std::chrono::system_clock, ...)
timer_queue_base is the base class of the timer-queues
the timer-queue's themselves are ownered by the io_context's executor via execution_context::add_service()
protected via 'mtx_'
|
private |