Threads: Remove unused on_wait() detection to simplify code

This commit is contained in:
Nekotekina 2020-02-25 15:36:08 +03:00
parent 136d769895
commit 3f943945a7

View File

@ -95,13 +95,6 @@ struct thread_on_cleanup : std::bool_constant<false> {};
template <typename T>
struct thread_on_cleanup<T, decltype(named_thread<T>::on_cleanup(std::declval<named_thread<T>*>()))> : std::bool_constant<true> {};
// Detect on_wait() method (should return bool)
template <typename T, typename = bool>
struct thread_on_wait : std::bool_constant<false> {};
template <typename T>
struct thread_on_wait<T, decltype(std::declval<named_thread<T>&>().on_wait())> : std::bool_constant<true> {};
template <typename T, typename = void>
struct thread_thread_name : std::bool_constant<false> {};
@ -345,14 +338,6 @@ class named_thread final : public Context, result_storage_t<Context>, thread_bas
return false;
}
if constexpr (thread_on_wait<Context>())
{
if (!static_cast<named_thread*>(_this)->on_wait())
{
return false;
}
}
_this->m_state_notifier.release(data);
if (!data)
@ -366,15 +351,6 @@ class named_thread final : public Context, result_storage_t<Context>, thread_bas
return false;
}
if constexpr (thread_on_wait<Context>())
{
if (!static_cast<named_thread*>(_this)->on_wait())
{
_this->m_state_notifier.release(nullptr);
return false;
}
}
return true;
});