We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 231cb29 commit 708445cCopy full SHA for 708445c
asio/include/asio/impl/thread_pool.ipp
@@ -125,9 +125,9 @@ void thread_pool::attach()
125
126
void thread_pool::join()
127
{
128
- if (joinable_)
+ bool expected = true;
129
+ if (joinable_.compare_exchange_strong(expected, false))
130
- joinable_ = false;
131
scheduler_.work_finished();
132
threads_.join();
133
}
asio/include/asio/thread_pool.hpp
@@ -229,7 +229,7 @@ class thread_pool
229
detail::atomic_count num_threads_;
230
231
// Whether a join call will have any effect.
232
- bool joinable_;
+ std::atomic<bool> joinable_;
233
};
234
235
/// Executor implementation type used to submit functions to a thread pool.
0 commit comments