diff --git a/Utilities/Thread.h b/Utilities/Thread.h index 46c1b94ba0..dca858baed 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -84,10 +84,17 @@ using result_storage_t = result_storage>; // Detect on_abort() method (should return void) template -struct thread_abort : std::bool_constant {}; +struct thread_on_abort : std::bool_constant {}; template -struct thread_abort&>().on_abort())> : std::bool_constant {}; +struct thread_on_abort&>().on_abort())> : std::bool_constant {}; + +// Detect on_cleanup() static function (should return void) +template +struct thread_on_cleanup : std::bool_constant {}; + +template +struct thread_on_cleanup::on_cleanup(std::declval*>()))> : std::bool_constant {}; // Simple list of void() functors class task_stack @@ -498,7 +505,7 @@ public: if (thread::m_state.compare_and_swap_test(thread_state::created, thread_state::aborting)) { // Call on_abort() method if it's available - if constexpr (thread_abort()) + if constexpr (thread_on_abort()) { Context::on_abort(); }