Skip to content
Merged
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
1 change: 1 addition & 0 deletions old_build/_deps/snitch-src
Submodule snitch-src added at 2f6230
12 changes: 8 additions & 4 deletions src/rpp/rpp/schedulers/new_thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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())
Expand Down