RESTinio
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes | List of all members
restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder > Class Template Reference

#include <ioctx_on_thread_pool.hpp>

Public Member Functions

 ioctx_on_thread_pool_t (const ioctx_on_thread_pool_t &)=delete
 
 ioctx_on_thread_pool_t (ioctx_on_thread_pool_t &&)=delete
 
template<typename... Io_Context_Holder_Ctor_Args>
 ioctx_on_thread_pool_t (std::size_t pool_size, Io_Context_Holder_Ctor_Args &&...ioctx_holder_args)
 
 ~ioctx_on_thread_pool_t ()
 
void start ()
 
void stop () noexcept
 
void wait () noexcept
 
bool started () const noexcept
 
asio_ns::io_context & io_context () noexcept
 

Private Types

enum class  status_t : std::uint8_t { stopped , started }
 

Private Attributes

Io_Context_Holder m_ioctx_holder
 
std::vector< std::thread > m_pool
 
status_t m_status
 

Detailed Description

template<typename Io_Context_Holder>
class restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >

Helper class for creating io_context and running it (via io_context::run()) on a thread pool.

Note
class is not thread-safe (except io_context() method). Expected usage scenario is to start and stop it on the same thread.
Template Parameters
Io_Context_HolderA type which actually holds io_context object or a reference to an external io_context object.

Definition at line 88 of file ioctx_on_thread_pool.hpp.

Member Enumeration Documentation

◆ status_t

Enumerator
stopped 
started 

Definition at line 194 of file ioctx_on_thread_pool.hpp.

Constructor & Destructor Documentation

◆ ioctx_on_thread_pool_t() [1/3]

◆ ioctx_on_thread_pool_t() [2/3]

◆ ioctx_on_thread_pool_t() [3/3]

template<typename... Io_Context_Holder_Ctor_Args>
restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::ioctx_on_thread_pool_t ( std::size_t pool_size,
Io_Context_Holder_Ctor_Args &&... ioctx_holder_args )
inline

Definition at line 95 of file ioctx_on_thread_pool.hpp.

◆ ~ioctx_on_thread_pool_t()

Definition at line 107 of file ioctx_on_thread_pool.hpp.

Member Function Documentation

◆ io_context()

asio_ns::io_context & restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::io_context ( )
inlinenoexcept

Definition at line 188 of file ioctx_on_thread_pool.hpp.

◆ start()

Definition at line 117 of file ioctx_on_thread_pool.hpp.

◆ started()

Definition at line 185 of file ioctx_on_thread_pool.hpp.

◆ stop()

Definition at line 160 of file ioctx_on_thread_pool.hpp.

◆ wait()

Definition at line 173 of file ioctx_on_thread_pool.hpp.

Member Data Documentation

◆ m_ioctx_holder

Definition at line 196 of file ioctx_on_thread_pool.hpp.

◆ m_pool

std::vector< std::thread > restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::m_pool
private

Definition at line 197 of file ioctx_on_thread_pool.hpp.

◆ m_status

Definition at line 198 of file ioctx_on_thread_pool.hpp.


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