Skip to content

Commit 30bb116

Browse files
daniel-schmidtDaniel Schmidtericniebler
authored
Fix missing enqueue notifications in timed_thread_context. (#2231)
* Fix missing enqueue notifications in timed_thread_context. The push_back of the command queue can return false during insertion of a new command. * obey @lewissbaker --------- Co-authored-by: Daniel Schmidt <daniel.schmidt@wibu.com> Co-authored-by: Eric Niebler <eniebler@nvidia.com>
1 parent 2173cc6 commit 30bb116

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎include/exec/timed_thread_scheduler.hpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ namespace experimental::execution
192192
while (
193193
!n_submissions_in_flight_.compare_exchange_weak(expected,
194194
context_closed,
195-
STDEXEC::__std::memory_order_relaxed))
195+
STDEXEC::__std::memory_order_acquire))
196196
{
197197
STDEXEC::__spin_loop_pause();
198198
expected = 0;
@@ -229,13 +229,13 @@ namespace experimental::execution
229229
STDEXEC::__std::memory_order_relaxed);
230230
return;
231231
}
232-
if (command_queue_.push_back(op))
232+
command_queue_.push_back(op);
233233
{
234234
std::scoped_lock lock{ready_mutex_};
235235
ready_ = true;
236-
cv_.notify_one();
237236
}
238-
n_submissions_in_flight_.fetch_sub(1, STDEXEC::__std::memory_order_relaxed);
237+
cv_.notify_one();
238+
n_submissions_in_flight_.fetch_sub(1, STDEXEC::__std::memory_order_release);
239239
}
240240

241241
void request_stop()

0 commit comments

Comments
 (0)