Skip to content
Merged
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
7 changes: 5 additions & 2 deletions source/adapters/native_cpu/threadpool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ class worker_thread {

// Waits for all tasks to finish and destroys the worker thread
inline void stop() {
m_isRunning.store(false, std::memory_order_release);
m_startWorkCondition.notify_all();
{
std::lock_guard<std::mutex> lock(m_workMutex);
m_isRunning.store(false, std::memory_order_release);
m_startWorkCondition.notify_all();
}
if (m_worker.joinable()) {
// Wait for the worker thread to finish handling the task queue
m_worker.join();
Expand Down