Skip to content

Commit cf240bf

Browse files
olegabrdeanberris
authored andcommitted
fix Resource deadlock avoided error (#817)
* fix Resource deadlock avoided error * fix boost -> std
1 parent f94635c commit cf240bf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

boost/network/protocol/http/client/async_impl.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ struct async_client
7474
void wait_complete() {
7575
sentinel_.reset();
7676
if (lifetime_thread_.get()) {
77-
lifetime_thread_->join();
77+
if (lifetime_thread_->joinable() && lifetime_thread_->get_id() != std::this_thread::get_id()) {
78+
lifetime_thread_->join();
79+
}
7880
lifetime_thread_.reset();
7981
}
8082
}

boost/network/utils/thread_group.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class thread_group {
5555
std::unique_lock<std::mutex> guard(m);
5656

5757
for (auto &thread : threads) {
58-
if (thread->joinable()) {
58+
if (thread->joinable() && thread->get_id() != std::this_thread::get_id()) {
5959
thread->join();
6060
}
6161
}

0 commit comments

Comments
 (0)