Merge pull request #42544 from ClickHouse/try-about-on-current-thread-join

Try abort on current thread join.
This commit is contained in:
Alexey Milovidov 2024-06-05 01:13:25 +02:00 committed by GitHub
commit a6fe50c103
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -280,6 +280,10 @@ public:
if (!initialized())
abort();
/// Thread cannot join itself.
if (state->thread_id == std::this_thread::get_id())
abort();
state->event.wait();
state.reset();
}
@ -293,12 +297,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();
}
std::thread::id get_id() const