Skip to content
Merged
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
10 changes: 5 additions & 5 deletions stdlib/public/Concurrency/TaskGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ class TaskGroupImpl: public TaskGroupTaskStatusRecord {
///
/// This is used to atomically perform a waiting task completion.
bool statusCompletePendingReadyWaiting(GroupStatus &old) {
return status.compare_exchange_weak(
return status.compare_exchange_strong(
old.status, old.completingPendingReadyWaiting().status,
/*success*/ std::memory_order_relaxed,
/*failure*/ std::memory_order_relaxed);
}

bool statusCompletePendingReady(GroupStatus &old) {
return status.compare_exchange_weak(
return status.compare_exchange_strong(
old.status, old.completingPendingReady().status,
/*success*/ std::memory_order_relaxed,
/*failure*/ std::memory_order_relaxed);
Expand Down Expand Up @@ -588,7 +588,7 @@ void TaskGroupImpl::offer(AsyncTask *completedTask, AsyncContext *context) {
assert(assumed.pendingTasks() && "offered to group with no pending tasks!");
// We are the "first" completed task to arrive,
// and since there is a task waiting we immediately claim and complete it.
if (waitQueue.compare_exchange_weak(
if (waitQueue.compare_exchange_strong(
waitingTask, nullptr,
/*success*/ std::memory_order_release,
/*failure*/ std::memory_order_acquire) &&
Expand Down Expand Up @@ -755,7 +755,7 @@ PollResult TaskGroupImpl::poll(AsyncTask *waitingTask) {

auto assumedStatus = assumed.status;
auto newStatus = TaskGroupImpl::GroupStatus{assumedStatus};
if (status.compare_exchange_weak(
if (status.compare_exchange_strong(
assumedStatus, newStatus.completingPendingReadyWaiting().status,
/*success*/ std::memory_order_relaxed,
/*failure*/ std::memory_order_acquire)) {
Expand Down Expand Up @@ -821,7 +821,7 @@ PollResult TaskGroupImpl::poll(AsyncTask *waitingTask) {
waitingTask->flagAsSuspended();
}
// Put the waiting task at the beginning of the wait queue.
if (waitQueue.compare_exchange_weak(
if (waitQueue.compare_exchange_strong(
waitHead, waitingTask,
/*success*/ std::memory_order_release,
/*failure*/ std::memory_order_acquire)) {
Expand Down