Skip to content

Commit 331ecfb

Browse files
committed
waitQueue.compare_exchange_strong in the true loop can be weak
weak is more suitable for this while loop than strong.
1 parent f08f86c commit 331ecfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ void TaskGroupBase::waitAll(SwiftError* bodyError, AsyncTask *waitingTask,
19471947
waitingTask->flagAsSuspendedOnTaskGroup(asAbstract(this));
19481948
}
19491949
// Put the waiting task at the beginning of the wait queue.
1950-
if (waitQueue.compare_exchange_strong(
1950+
if (waitQueue.compare_exchange_weak(
19511951
waitHead, waitingTask,
19521952
/*success*/ std::memory_order_release,
19531953
/*failure*/ std::memory_order_acquire)) {

0 commit comments

Comments
 (0)