diff --git a/old_build/_deps/snitch-src b/old_build/_deps/snitch-src new file mode 160000 index 000000000..2f6230890 --- /dev/null +++ b/old_build/_deps/snitch-src @@ -0,0 +1 @@ +Subproject commit 2f623089022ba09d4bcaf21772684b94a160a1e0 diff --git a/src/rpp/rpp/schedulers/new_thread.hpp b/src/rpp/rpp/schedulers/new_thread.hpp index d8bba7fa3..4aa176dec 100644 --- a/src/rpp/rpp/schedulers/new_thread.hpp +++ b/src/rpp/rpp/schedulers/new_thread.hpp @@ -45,8 +45,10 @@ namespace rpp::schedulers if (!m_thread.joinable()) return; - // just notify - m_state->is_destroying.store(true, std::memory_order::seq_cst); + { + std::lock_guard lock{m_state->mutex}; + m_state->is_destroying.store(true, std::memory_order::relaxed); + } m_state->cv.notify_all(); m_thread.detach(); } @@ -69,8 +71,10 @@ namespace rpp::schedulers if (!m_thread.joinable()) return; - // just need atomicity, not guarding anything - m_state->is_disposed.store(true, std::memory_order::seq_cst); + { + std::lock_guard lock{m_state->mutex}; + m_state->is_disposed.store(true, std::memory_order::relaxed); + } m_state->cv.notify_all(); if (m_thread.get_id() != std::this_thread::get_id())