Helper class for automatic close of a mchain at the destruction of master handle instance.
More...
#include <mchain_helper_functions.hpp>
Helper class for automatic close of a mchain at the destruction of master handle instance.
This class is intended for cases like that:
...
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > auto_close_drop_content(Tail &&... tail)
Helper function for automatic closing of mchains with dropping their content.
mchain_t create_mchain(environment_t &env)
Create size-unlimited chain.
The example shown above can be replaced by:
Helper class for automatic close of a mchain at the destruction of master handle instance.
static mchain_master_handle_t make(mchain_t chain, mchain_props::close_mode_t close_mode) noexcept
static mchain_master_handle_t with_drop_content(mchain_t chain) noexcept
@ drop_content
All messages must be removed from chain.
- Attention
- Since v.5.7.3 it uses so_5::terminate_if_throws calling 'close' for mchains.
- Note
- This class is moveable but not copyable.
- Since
- v.5.5.17
Definition at line 514 of file mchain_helper_functions.hpp.
◆ mchain_master_handle_t() [1/3]
◆ mchain_master_handle_t() [2/3]
Initializing constructor.
- Parameters
-
| chain | A mchain itself. |
| close_mode | Close mode for mchain. |
Definition at line 522 of file mchain_helper_functions.hpp.
◆ mchain_master_handle_t() [3/3]
◆ ~mchain_master_handle_t()
| so_5::mchain_master_handle_t::~mchain_master_handle_t |
( |
| ) |
|
|
inline |
◆ get()
| const mchain_t & so_5::mchain_master_handle_t::get |
( |
| ) |
const |
|
inlinenoexcept |
◆ make()
- Usage example:
{
std::thread worker;
detect_close_mode( config ) );
worker = std::thread( [ch = *chain]{ ... } );
...
}
thread_auto_join_details::auto_joiner_t< 1+sizeof...(Tail) > auto_join(std::thread &first_thread, Tail &&... tail)
Helper function for creation of automatic joiner of std::threads.
Definition at line 592 of file mchain_helper_functions.hpp.
◆ operator*()
| const mchain_t & so_5::mchain_master_handle_t::operator* |
( |
| ) |
const |
|
inlinenoexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ with_drop_content()
◆ with_retain_content()
- Usage example:
{
std::thread worker;
worker = std::thread( [ch = *chain]{ ... } );
...
}
static mchain_master_handle_t with_retain_content(mchain_t chain) noexcept
Definition at line 639 of file mchain_helper_functions.hpp.
◆ swap
◆ m_chain
| mchain_t so_5::mchain_master_handle_t::m_chain |
|
private |
◆ m_close_mode
The documentation for this class was generated from the following file: