Skip to content

Commit e9b25d1

Browse files
committed
[Concurrency] Move innermost record assertion to handle more gracefully
1 parent da59253 commit e9b25d1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

stdlib/public/Concurrency/TaskStatus.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,23 +1031,23 @@ static swift_task_escalateImpl(AsyncTask *task, JobPriority newPriority) {
10311031
// Task is not running, it's enqueued somewhere waiting to be run
10321032
//
10331033
// TODO (rokhinip): Add a stealer to escalate the thread request for
1034-
// the task. Still mark the task has having been escalated so that the
1035-
// thread will self override when it starts draining the task
1034+
// the task. Still mark the task has having been escalated so that the
1035+
// thread will self override when it starts draining the task
10361036
//
10371037
// TODO (rokhinip): Add a signpost to flag that this is a potential
1038-
// priority inversion
1038+
// priority inversion
10391039
SWIFT_TASK_DEBUG_LOG("[Override] Escalating %p which is enqueued", task);
10401040

1041-
} else {
1042-
SWIFT_TASK_DEBUG_LOG("[Override] Escalating %p which is suspended to %#x", task, newPriority);
1043-
// We must have at least one record - the task dependency one.
1044-
assert(newStatus.getInnermostRecord() != NULL);
10451041
}
10461042

10471043
if (newStatus.getInnermostRecord() == NULL) {
10481044
return newStatus.getStoredPriority();
10491045
}
10501046

1047+
SWIFT_TASK_DEBUG_LOG("[Override] Escalating %p which is suspended to %#x", task, newPriority);
1048+
// We must have at least one record - the task dependency one.
1049+
assert(newStatus.getInnermostRecord() != NULL);
1050+
10511051
withStatusRecordLock(task, newStatus, [&](ActiveTaskStatus status) {
10521052
// We know that none of the escalation actions will recursively
10531053
// modify the task status record list by adding or removing task records

0 commit comments

Comments
 (0)