Try abort on current thread join.

This commit is contained in:
Nikolai Kochetov 2022-10-20 19:43:42 +00:00
parent 58f238007a
commit ecc23867db

View File

@ -237,6 +237,10 @@ public:
if (!initialized())
abort();
/// Thread cannot join itself.
if (state->thread_id == std::this_thread::get_id())
abort();
state->event.wait();
state.reset();
}
@ -250,12 +254,7 @@ public:
bool joinable() const
{
if (!state)
return false;
/// Thread cannot join itself.
if (state->thread_id == std::this_thread::get_id())
return false;
return true;
return initialized();
}
protected: