Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions asio/include/asio/impl/thread_pool.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ void thread_pool::attach()

void thread_pool::join()
{
if (joinable_)
bool expected = true;
if (joinable_.compare_exchange_strong(expected, false))
{
joinable_ = false;
scheduler_.work_finished();
threads_.join();
}
Expand Down
2 changes: 1 addition & 1 deletion asio/include/asio/thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class thread_pool
detail::atomic_count num_threads_;

// Whether a join call will have any effect.
bool joinable_;
std::atomic<bool> joinable_;
};

/// Executor implementation type used to submit functions to a thread pool.
Expand Down