19 #include "../../core/intrusive.hpp"
20 #include "../../core/memory_buffer.hpp"
21 #include "../../core/thread_os_traits.hpp"
51 cfg_details.update_edge(e_details);
54 cfg_details.delete_edge();
57 cfg_details.checkpoint_cfg();
60 return cfg_details.vertex();
90 void (
__fastcall InpWk::*Proc)()
noexcept(NoExcept),
93 class closure_void_static
final :
public InpWk,
public closure_base<CFG> {
105 bool __fastcall operator<(
const closure_void_static &)
const noexcept(
true)
FORCE_INLINE;
125 friend inline tostream &
__fastcall operator<<(
tostream &os, closure_void_static
const &w)
noexcept(
false) {
126 using thread_traits=api_threading_traits<
ppd::platform_api,
ppd::sequential_mode>;
130 <<
_T(
", type: ")<<thread_traits::demangle_name(
typeid(w))
131 <<
_T(
", mutator: ")<<thread_traits::demangle_name(
typeid(Proc))
132 <<
_T(
", argument_type: ")<<thread_traits::demangle_name(
typeid(argument_type))
134 <<
_T(
", result_type: void");
153 void (
__fastcall InpWk::*Proc)()
const noexcept(NoExcept),
156 class closure_void_static_const
final :
public InpWk,
public closure_base<CFG> {
167 bool __fastcall operator==(
const closure_void_static_const &)
const noexcept(
true)
FORCE_INLINE;
168 bool __fastcall operator<(
const closure_void_static_const &)
const noexcept(
true)
FORCE_INLINE;
184 friend inline tostream &
__fastcall operator<<(
tostream &os, closure_void_static_const
const &w)
noexcept(
false) {
185 using thread_traits=api_threading_traits<
ppd::platform_api,
ppd::sequential_mode>;
189 <<
_T(
", type: ")<<thread_traits::demangle_name(
typeid(w))
190 <<
_T(
", mutator: ")<<thread_traits::demangle_name(
typeid(Proc))
191 <<
_T(
", argument_type: ")<<thread_traits::demangle_name(
typeid(argument_type))
193 <<
_T(
", result_type: void");
213 void (
__fastcall InpWk::*Proc)(Res &)
noexcept(NoExcept),
228 bool __fastcall operator<(
const closure_static &)
const noexcept(
true)
FORCE_INLINE;
249 friend inline tostream &
__fastcall operator<<(
tostream &os, closure_static
const &w)
noexcept(
false) {
250 using thread_traits=api_threading_traits<
ppd::platform_api,
ppd::sequential_mode>;
254 <<
_T(
", type: ")<<thread_traits::demangle_name(
typeid(w))
255 <<
_T(
", mutator: ")<<thread_traits::demangle_name(
typeid(Proc))
256 <<
_T(
", argument_type: ")<<thread_traits::demangle_name(
typeid(argument_type))
258 <<
_T(
", result_type: ")<<thread_traits::demangle_name(
typeid(result_type));
283 void (
__fastcall InpWk::*Proc)(Res &, CFGP
const &)
noexcept(NoExcept),
286 class closure_static_cfg
final :
public InpWk,
public closure_base<CFG> {
298 bool __fastcall operator<(
const closure_static_cfg &)
const noexcept(
true)
FORCE_INLINE;
319 friend inline tostream &
__fastcall operator<<(
tostream &os, closure_static_cfg
const &w)
noexcept(
false) {
320 using thread_traits=api_threading_traits<
ppd::platform_api,
ppd::sequential_mode>;
324 <<
_T(
", type: ")<<thread_traits::demangle_name(
typeid(w))
325 <<
_T(
", mutator: ")<<thread_traits::demangle_name(
typeid(Proc))
326 <<
_T(
", argument_type: ")<<thread_traits::demangle_name(
typeid(argument_type))
328 <<
_T(
", result_type: ")<<thread_traits::demangle_name(
typeid(result_type));
353 void (
__fastcall InpWk::*Proc)(Res &)
const noexcept(NoExcept),
356 class closure_static_const
final :
public InpWk,
public closure_base<CFG> {
368 bool __fastcall operator<(
const closure_static_const &)
const noexcept(
true)
FORCE_INLINE;
389 friend inline tostream &
__fastcall operator<<(
tostream &os, closure_static_const
const &w)
noexcept(
false) {
390 using thread_traits=api_threading_traits<
ppd::platform_api,
ppd::sequential_mode>;
394 <<
_T(
", type: ")<<thread_traits::demangle_name(
typeid(w))
395 <<
_T(
", mutator: ")<<thread_traits::demangle_name(
typeid(Proc))
396 <<
_T(
", argument_type: ")<<thread_traits::demangle_name(
typeid(argument_type))
398 <<
_T(
", result_type: ")<<thread_traits::demangle_name(
typeid(result_type));
423 void (
__fastcall InpWk::*Proc)(Res &, CFGP
const &)
const noexcept(NoExcept),
426 class closure_static_cfg_const
final :
public InpWk,
public closure_base<CFG> {
438 bool __fastcall operator<(
const closure_static_cfg_const &)
const noexcept(
true)
FORCE_INLINE;
459 friend inline tostream &
__fastcall operator<<(
tostream &os, closure_static_cfg_const
const &w)
noexcept(
false) {
460 using thread_traits=api_threading_traits<
ppd::platform_api,
ppd::sequential_mode>;
464 <<
_T(
", type: ")<<thread_traits::demangle_name(
typeid(w))
465 <<
_T(
", mutator: ")<<thread_traits::demangle_name(
typeid(Proc))
466 <<
_T(
", argument_type: ")<<thread_traits::demangle_name(
typeid(argument_type))
468 <<
_T(
", result_type: ")<<thread_traits::demangle_name(
typeid(result_type));
508 virtual bool __fastcall operator<(
thread_wk_base const &)
const noexcept(
true)=0;
510 return !(*
this<ctw) && !(ctw<*
this);
514 virtual void update_edge(
typename cfg_type::node_property_t::value_type
const e_details)
noexcept(
false)=0;
537 template<
class>
class Del,
538 template<
class>
class AtCtr,
541 class thread_wk_async_t;
545 template<
typename OST,
template<
class>
class Del,
template<
class>
class AtCtr,
class CFG>
546 class thread_wk_async_t<
generic_traits::
return_data::
nonjoinable,
OST,
Del,
AtCtr,
CFG> :
public thread_wk_base<
OST,
CFG>,
public sp_counter_type<
long,
typename thread_wk_base<
OST,
CFG>::
lock_traits,
Del,
AtCtr> {
570 return _T(
"result_traits=nonjoinable");
579 template<
typename OST,
template<
class>
class Del,
template<
class>
class AtCtr,
class CFG>
580 class thread_wk_async_t<
generic_traits::
return_data::
joinable,
OST,
Del,
AtCtr,
CFG> :
public thread_wk_base<
OST,
CFG>,
public sp_counter_type<
long,
typename thread_wk_base<
OST,
CFG>::
lock_traits,
Del,
AtCtr> {
612 return _T(
"result_traits=joinable");
619 template<
generic_traits::
return_data RD,
typename OST,
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr,
class CFG>
623 template<
typename OST,
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr,
class CFG>
624 class thread_wk<
generic_traits::
return_data::
nonjoinable,
OST,
ThrW,
WFlg,
Del,
AtCtr,
CFG> :
public thread_wk_async_t<
generic_traits::
return_data::
nonjoinable,
OST,
Del,
AtCtr,
CFG> {
674 <<
_T(
", enqueued work=0x")<<
this
688 template<
typename OST,
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr,
class CFG>
689 class thread_wk<
generic_traits::
return_data::
joinable,
OST,
ThrW,
WFlg,
Del,
AtCtr,
CFG> :
public thread_wk_async_t<
generic_traits::
return_data::
joinable,
OST,
Del,
AtCtr,
CFG> {
738 #if defined(__GNUC__
) && !defined(__clang__
)
756 <<
_T(
", enqueued work=0x")<<
this
774 template<
typename OST,
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr,
class CFG>
792 work_complete_.lock_containers();
797 return dynamic_cast<algo_thread_wk
const *>(&cw) ?
static_cast<algo_thread_wk
const &>(cw)<*
this :
false;
800 return closure_wk_<ctw.closure_wk_;
811 return exception_thrown_in_thread_;
814 exception_thrown_in_thread_.throw_if_set();
817 return &work_complete_;
820 closure_wk_.update_edge(e_details);
827 closure_wk_.process();
828 #if defined(__GNUC__
) && !defined(__clang__
)
829 }
catch (abi::__forced_unwind &) {
833 exception_thrown_in_thread_.set(std::current_exception());
835 closure_wk_.update_edge(e_details);
838 closure_wk_.process();
839 closure_wk_.update_edge(e_details);
843 work_complete_.resize_output(out_colln_size);
849 <<base_t::to_string()
850 <<
_T(
", enqueued work=0x")<<
this
851 <<
_T(
", enqueued type: ")<<os_traits::thread_traits::demangle_name(
typeid(*
this))
852 <<
_T(
", work complete event=0x")<<&work_complete_
853 <<
_T(
", work details: ")<<closure_wk_
854 <<
_T(
", exception details: ")<<exception_thrown_in_thread_;
860 typename os_traits::thread_exception exception_thrown_in_thread_;
870 template<
typename OST,
class ThrW,
class WFlg,
class SubDivAlgWk,
template<
class>
class Del,
template<
class>
class AtCtr,
class CFG>
893 return algo_work_heap_;
899 <<base_t::to_string()
900 <<
_T(
", algo_work_heap: ")<<algo_work_heap_;