Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
cwharris committed Apr 4, 2024
1 parent 1c60acb commit 1a45e4c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cpp/mrc/src/public/coroutines/task_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,9 @@ auto TaskContainer::make_cleanup_task(Task<void> user_task, task_position_t pos)
m_tasks_to_delete.push_back(pos);
// This has to be done within scope lock to make sure this coroutine task completes before the
// task container object destructs -- if it was waiting on .empty() to become true.
m_size.fetch_sub(1, std::memory_order::relaxed);
}

m_size.fetch_sub(1, std::memory_order::relaxed);

if (not m_next_tasks.empty())
{
start_next_task();
Expand Down

0 comments on commit 1a45e4c

Please sign in to comment.