Skip to content

task core: SuspensionPoint pending-cancel parity; async subtask.cancel releases its claim at park entry - #306

Merged
lannbot merged 1 commit into
mainfrom
fix/review2-cancel-parity
Sep 7, 2026
Merged

task core: SuspensionPoint pending-cancel parity; async subtask.cancel releases its claim at park entry#306
lannbot merged 1 commit into
mainfrom
fix/review2-cancel-parity

Conversation

@lannbot

@lannbot lannbot commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Round-2 follow-ups from the correctness review, task-core track. Mechanisms in the commit message.

Gates: full just gates green on the union with the follow-ups PR (runtime, conformance 0/0 stale, seeds, 3 shell + 6 browser lanes, smokes).

Closes #295. Closes #300. Automerge armed.

…ancel releases its claim at park entry

Two follow-ups from the correctness review's task-core track.

#300 — runtime/src/jspi/bridge.ts. `SuspensionPoint` gets the three changes
PR #302 gave `Thread.waitUntil` (definitions.py `Thread.wait_until`
361-373): `ready()` gains the `cancellable && has_pending_cancel()` disjunct
(with the live "lock is free" conjunct, `Task.implicitThreadCancellable`,
unconditional here because a SuspensionPoint is always a frame of the
implicit thread); `resume()` runs `deliverPendingCancel` after the block so
a wakeup taken through that disjunct is a cancelled resume; `cancellable`
is cleared on resume. Unreachable through today's guests (the only
pending-cancel producer never applies to a SuspensionPoint owner) — the
point is that the two block paths no longer diverge. Both hooks are
feature-detected because some parks carry a non-Task stub.
Regression: suspension_point_pending_cancel_test.ts (2 arms, fail pre-fix).

#295 — runtime/src/intrinsics/async_builtins.ts. The #92 determinacy park
held `hasSyncWaiter` across the whole async-form park; the reference
(`canon_subtask_cancel` 2455-2461) clears it before returning BLOCKED, so
the claim spans only the synchronous window around `on_cancel()`. A sibling
thread running during our park and calling `waitable.join` on the same
subtask trapped where the reference succeeds — #92 licenses a reordering,
not a new trap. The async form now clears the flag at park entry; the sync
form is unchanged (its `wait_until` is inside the window).
Regression: subtask_cancel_sync_waiter_window_test.ts.

Closes #295. Closes #300.
@lannbot
lannbot enabled auto-merge September 7, 2026 03:13
@lannbot
lannbot merged commit b594049 into main Sep 7, 2026
4 checks passed
@lannbot
lannbot deleted the fix/review2-cancel-parity branch September 7, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants