RESTinio
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 73 of file ioctx_on_thread_pool.hpp.

Member Enumeration Documentation

◆ status_t

template<typename Io_Context_Holder >
enum class restinio::impl::ioctx_on_thread_pool_t::status_t : std::uint8_t
strongprivate
Enumerator
stopped 
started 

Definition at line 180 of file ioctx_on_thread_pool.hpp.

Constructor & Destructor Documentation

◆ ioctx_on_thread_pool_t() [1/3]

template<typename Io_Context_Holder >
restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::ioctx_on_thread_pool_t ( const ioctx_on_thread_pool_t< Io_Context_Holder > &  )
delete

◆ ioctx_on_thread_pool_t() [2/3]

template<typename Io_Context_Holder >
restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::ioctx_on_thread_pool_t ( ioctx_on_thread_pool_t< Io_Context_Holder > &&  )
delete

◆ ioctx_on_thread_pool_t() [3/3]

template<typename Io_Context_Holder >
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 80 of file ioctx_on_thread_pool.hpp.

◆ ~ioctx_on_thread_pool_t()

template<typename Io_Context_Holder >
restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::~ioctx_on_thread_pool_t ( )
inline

Definition at line 93 of file ioctx_on_thread_pool.hpp.

Member Function Documentation

◆ io_context()

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

Definition at line 174 of file ioctx_on_thread_pool.hpp.

◆ start()

template<typename Io_Context_Holder >
void restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::start ( )
inline

Definition at line 103 of file ioctx_on_thread_pool.hpp.

◆ started()

template<typename Io_Context_Holder >
bool restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::started ( ) const
inlinenoexcept

Definition at line 171 of file ioctx_on_thread_pool.hpp.

◆ stop()

template<typename Io_Context_Holder >
void restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::stop ( )
inlinenoexcept

Definition at line 146 of file ioctx_on_thread_pool.hpp.

◆ wait()

template<typename Io_Context_Holder >
void restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::wait ( )
inlinenoexcept

Definition at line 159 of file ioctx_on_thread_pool.hpp.

Member Data Documentation

◆ m_ioctx_holder

template<typename Io_Context_Holder >
Io_Context_Holder restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::m_ioctx_holder
private

Definition at line 182 of file ioctx_on_thread_pool.hpp.

◆ m_pool

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

Definition at line 183 of file ioctx_on_thread_pool.hpp.

◆ m_status

template<typename Io_Context_Holder >
status_t restinio::impl::ioctx_on_thread_pool_t< Io_Context_Holder >::m_status
private

Definition at line 184 of file ioctx_on_thread_pool.hpp.


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