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
3 changes: 3 additions & 0 deletions stdlib/public/Concurrency/TaskStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,9 @@ static swift_task_escalateImpl(AsyncTask *task, JobPriority newPriority) {
auto newStatus = oldStatus;

while (true) {
// Ensure oldPriority is up to date if we retry the compare_exchange.
oldPriority = oldStatus.getStoredPriority();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikeash small nit/question here – do we still need to read the priority on L1138 after this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't, but it feels weird to leave it uninitialized and that's a good enough initial value. The optimizer will eliminate the redundant read for us anyway.


// Fast path: check that the stored priority is already at least
// as high as the desired priority.
if (oldPriority >= newPriority) {
Expand Down