Rename sync method parameters

This commit is contained in:
chenht2022 2025-10-28 03:28:41 +00:00
parent d7ab3b41b7
commit 4a9b6cd99e
4 changed files with 15 additions and 10 deletions

View file

@ -42,7 +42,11 @@ void TaskQueue::enqueue(std::function<void()> task) {
prev->next.store(node, std::memory_order_release);
}
void TaskQueue::sync(size_t n) { while (pending.load(std::memory_order_acquire) > n); }
void TaskQueue::sync(size_t allow_n_pending) {
// Spin until the pending task count drops to the allowed threshold.
while (pending.load(std::memory_order_acquire) > allow_n_pending)
;
}
void TaskQueue::worker() {
Node* curr = head.load(std::memory_order_relaxed);