MySQL 8.0.40
Source Code Documentation
IoComponent Class Reference

#include <io_component.h>

Classes

class  Workguard
 

Public Member Functions

std::list< IoThread > & io_threads ()
 
net::io_contextio_context ()
 get ref to the io_context. More...
 
stdx::expected< void, std::error_code > init (size_t num_worker_threads, const std::string &backend_name)
 initialize io-component. More...
 
void run ()
 run the main loop of the io-component. More...
 
void stop ()
 
void reset ()
 reset the io_component into its initial state. More...
 
std::string backend_name () const
 
Workguard work_guard ()
 

Static Public Member Functions

static IoComponentget_instance ()
 

Private Member Functions

 IoComponent ()=default
 

Private Attributes

std::list< IoThreadio_threads_
 
std::unique_ptr< net::io_contextio_ctx_
 
std::atomic< int > users_ {}
 
std::string backend_name_
 

Constructor & Destructor Documentation

◆ IoComponent()

IoComponent::IoComponent ( )
privatedefault

Member Function Documentation

◆ backend_name()

std::string IoComponent::backend_name ( ) const
inline

◆ get_instance()

IoComponent & IoComponent::get_instance ( )
static

◆ init()

stdx::expected< void, std::error_code > IoComponent::init ( size_t  num_worker_threads,
const std::string &  backend_name 
)

initialize io-component.

use IoComponent::reset() to reset the io-component into its initial state

Parameters
num_worker_threadsnumber of worker-threads to spawn
backend_namename of the io-backend
See also
IoComponent::reset()

◆ io_context()

net::io_context & IoComponent::io_context ( )

get ref to the io_context.

behaviour is undefined when called before IoComponent::init() and after IoComponent::reset()

◆ io_threads()

std::list< IoThread > & IoComponent::io_threads ( )
inline

◆ reset()

void IoComponent::reset ( )

reset the io_component into its initial state.

when calling reset() no io-thread SHALL run which can be achieved by

  • calling stop() after run() was called.
  • not calling run()

◆ run()

void IoComponent::run ( )

run the main loop of the io-component.

runs until all no more work is assigned to the mainloop or stopped.

See also
IoComponent::stop()

◆ stop()

void IoComponent::stop ( )

◆ work_guard()

Workguard IoComponent::work_guard ( )

Member Data Documentation

◆ backend_name_

std::string IoComponent::backend_name_
private

◆ io_ctx_

std::unique_ptr<net::io_context> IoComponent::io_ctx_
private

◆ io_threads_

std::list<IoThread> IoComponent::io_threads_
private

◆ users_

std::atomic<int> IoComponent::users_ {}
private

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