Files
Bryce Wilson 0627be9d89 [Concurrency] Introduce Task Stealers
Adds an AsyncTaskStealer object and the machinery to enqueue a Task with a
stealer whenever intrusive enqueue isn't available, enabling stealers on the
regular enqueue path and on the executor escalation path.

Key changes:

 - AsyncTaskStealer: a new object that stands in for a Task in executor
   queues when the Task is already linked intrusively. Executor and task-ID
   lookups now look through the stealer.
 - Stealer exclusion value: a value stored on the Task that lets a stealer
   determine whether it still owns the right to run the Task; if the value
   has changed, the stealer bails out rather than double-running.
 - removeStatusRecordIf: a fallible variant of removeStatusRecord that
   refuses to remove the record when a condition has changed. Used as the
   syncronization point for the exclusion value.
 - IsEnqueued flag: replaced with a bit that records whether the Task is
   currently intrusively linked.
 - SchedulerPrivate is no longer used by the runtime while the Task is
   suspended. The dependency record's backlink is dropped and the current
   task is plumbed through the escalation path which is the only place the
   backlink was needed.
 - flagAsRunning refactor: splits out flagAsRunningFromSuspended (no
   exclusion value, no opaque return) and taskInvokeWithExclusionValue
   (which conditionally calls runInFullyEstablishedContext when
   flagAsRunningFromEnqueued succeeds). Both take invokeFlags so the
   stealer path is distinguishable. A new ThreadPriorityManager centralizes
   self-escalation and base-priority lowering, cutting duplication.
 - Adds a test that priority escalation works while a Task is enqueued,
   plus additional/corrected task debug logs.

Radar-Id: rdar://problem/160967177
2026-07-09 20:12:52 -07:00
..
…
2026-02-06 08:53:16 +00:00
…
…
…
…
…