swift
a04febd2 - [Concurrency] Deadline inheritance: walk parent chain instead of copying records

Commit
70 days ago
[Concurrency] Deadline inheritance: walk parent chain instead of copying records Replaces the previous copy-based inheritance with the same pattern task-local values use: at child creation, propagate only the HasDeadline flag from the parent. The actual lookup in swift_task_findNearestDeadlineForClock walks up childFragment()->getParent() when the local chain misses. Advantages over copying: - No allocations at child creation - just a flag bit. - No retain-per-inherited-record on each _ClockBox, no destructor cleanup path to unbalance them. - Structured invariant matches SE-0526's phrasing (line 393-395): "hasActiveDeadline applies to the current task or child task if the execution of that task is within a call to withDeadline" - the answer is derived by walking the enclosing task chain, exactly like the proposal's "next nesting up the call stack is used" wording. - Detached tasks still correctly do NOT inherit: they have no childFragment, so the walk stops immediately. Renames AsyncTask::inheritDeadlinesFrom -> inheritDeadlineFlagFrom to match the new semantics. Removes cleanupInheritedDeadlines entirely (no per-child retains to release anymore). Removes the ~AsyncTask() hook that called it. Also factors the single-task walk into a static findDeadlineOnSingleTask helper to keep the outer walk-parent-chain loop readable. Runtime tests unchanged - they exercise structured children observing the parent's deadline, which continues to work under the new model. Concurrency dylib builds cleanly.
Author
Parents
Loading