libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
This class is used to implement a class that wraps using a thread, it is an alternative to using a thread pool to manage your threads, in a C++ std::thread-style manner. More...
#include <thread_wrapper.hpp>
Public Member Functions | |
__stdcall | thread (const typename thread_traits::api_params_type::suspend_period_ms ew_=50) noexcept(false) FORCE_INLINE |
template<class ProcFn > | |
__stdcall | thread (ProcFn &&proc_fn, const typename thread_traits::api_params_type::suspend_period_ms ew_=50) noexcept(false) FORCE_INLINE |
Create the wrapper object. Note that the underlying kernel thread will have been created, so the proc_fn will execute in the underlying thread (if any). More... | |
__stdcall | ~thread () noexcept(false) override FORCE_INLINE |
template<class ProcFn > | |
thread (ProcFn &&proc_fn, const typename thread_traits::api_params_type::suspend_period_ms ew) noexcept(false) | |
![]() | |
__stdcall | wrapper (const wrapper &) noexcept(true) FORCE_INLINE |
Create the wrapper object. Note that the underlying kernel thread will not have been created. More... | |
wrapper (wrapper &&)=delete | |
__stdcall | ~wrapper () noexcept(false) override FORCE_INLINE |
void | operator= (wrapper const &)=delete |
void | operator= (wrapper &&)=delete |
![]() | |
virtual void __fastcall | create_running () noexcept(false) |
Start the underlying kernel thread. More... | |
const thread_traits::api_params_type &__fastcall | params () const noexcept(true) FORCE_INLINE |
const thread_traits::api_params_type::suspend_count __fastcall | suspend () noexcept(true) |
const thread_traits::api_params_type::suspend_count __fastcall | resume () noexcept(true) |
const thread_traits::api_params_type::states __fastcall | state () const noexcept(true) |
bool __fastcall | is_running () const noexcept(true) |
thread_traits::api_params_type::priority_type __fastcall | kernel_priority () const noexcept(false) |
void __fastcall | kernel_priority (const typename thread_traits::api_params_type::priority_type priority) noexcept(false) |
thread_traits::api_params_type::processor_mask_type __fastcall | kernel_affinity () const noexcept(false) |
void __fastcall | kernel_affinity (const typename thread_traits::api_params_type::processor_mask_type &mask) noexcept(false) |
void __fastcall | set_name (char const *name) noexcept(false) |
virtual const tstring __fastcall | to_string () const noexcept(false) |
virtual void __fastcall | request_exit () const noexcept(false) |
Static Public Attributes | |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode |
![]() | |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode |
![]() | |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode =lock_traits::critical_section_type::memory_access_mode |
Additional Inherited Members | |
![]() | |
const thread_traits::api_params_type::suspend_period_ms | exit_wait_period |
![]() | |
__stdcall | wrapper (const typename thread_traits::api_params_type::suspend_period_ms ew_=50) noexcept(false) FORCE_INLINE |
__stdcall | wrapper (thread_context_t &&thread_context, const typename thread_traits::api_params_type::suspend_period_ms ew_=50) noexcept(false) FORCE_INLINE |
virtual bool __fastcall | pre_exit () noexcept(false) FORCE_INLINE |
The method used to determine if there has been a request for the thread to exit, and therefore finish processing work, called before attempting to process() a work item. More... | |
virtual bool __fastcall | worker_fn (thread_context_t &context) noexcept(false)=0 |
This is the main "work" function. Implement it to do some work in the thread. More... | |
thread_traits::api_params_type::states __fastcall | process () noexcept(false) override |
Override this function is you want to do some other work to signal the exit of the thread. More... | |
![]() | |
__stdcall | thread_base (const typename thread_traits::api_params_type::suspend_period_ms exit_wait_p) noexcept(false) |
Create the wrapper object. Note that the underlying kernel thread will not have been started. More... | |
__stdcall | thread_base (const thread_base &tb) noexcept(true) |
virtual __stdcall | ~thread_base () noexcept(false) |
Thread base dtor. More... | |
void __fastcall | wait_thread_exit () noexcept(false) |
![]() | |
std::atomic< bool > | exit_requested |
![]() | |
os_traits::thread_exception | exception_thrown_in_thread |
This is to allow exceptions thrown in the contained thread to be (hopefully) propagated back to another thread on which that exception can be caught & handled. More... | |
lock_traits::critical_section_type | thread_params_lock |
thread_traits::api_params_type | thread_params |
This class is used to implement a class that wraps using a thread, it is an alternative to using a thread pool to manage your threads, in a C++ std::thread-style manner.
Definition at line 125 of file thread_wrapper.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::thread< API, Mdl >::base_t = wrapper<API, Mdl, std::function<void()> > |
Definition at line 127 of file thread_wrapper.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::thread< API, Mdl >::exception_type = typename base_t::exception_type |
Definition at line 132 of file thread_wrapper.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::thread< API, Mdl >::lock_traits = typename base_t::lock_traits |
Definition at line 129 of file thread_wrapper.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::thread< API, Mdl >::os_traits = typename base_t::os_traits |
Definition at line 131 of file thread_wrapper.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::thread< API, Mdl >::thread_context_t = typename base_t::thread_context_t |
Definition at line 128 of file thread_wrapper.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::thread< API, Mdl >::thread_traits = typename base_t::thread_traits |
Definition at line 130 of file thread_wrapper.hpp.
|
inlineexplicitnoexcept |
Definition at line 66 of file thread_wrapper_impl.hpp.
|
explicitnoexcept |
Create the wrapper object. Note that the underlying kernel thread will have been created, so the proc_fn will execute in the underlying thread (if any).
This ctor requires a memory allocation for the functor.
proc_fn | The functor that will executed by the underlying kernel thread (if any). |
|
inlineoverridenoexcept |
Definition at line 78 of file thread_wrapper_impl.hpp.
|
inlinenoexcept |
Definition at line 72 of file thread_wrapper_impl.hpp.
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 137 of file thread_wrapper.hpp.