diff options
| author | t <t@tjp.lol> | 2026-08-21 11:26:48 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-08-21 11:26:48 -0600 |
| commit | 49a6001dde72622df9410b738322e9a23e68ddee (patch) | |
| tree | c00f587a76b186f69872ba7362b77b9637358293 /subagents/jobs.lua | |
| parent | 2d4981b3870f2aee75d03006eea6318c501fe47b (diff) | |
Add workflow cancellation controls
Diffstat (limited to 'subagents/jobs.lua')
| -rw-r--r-- | subagents/jobs.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/subagents/jobs.lua b/subagents/jobs.lua index 9fe5c93..dc166a7 100644 --- a/subagents/jobs.lua +++ b/subagents/jobs.lua @@ -280,6 +280,21 @@ function handle_mt:cancel() end end +-- Cancel one known handle and wake parked awaiters. `handle:cancel()` remains +-- the narrow primitive; workflow records use this helper because cancelling a +-- queued child settles it synchronously. +function M.cancel(handle) + if getmetatable(handle) ~= handle_mt then + error("jobs.cancel expects a job handle", 2) + end + if handle.settled ~= nil then + return false + end + handle:cancel() + wake() + return true +end + -- start(startspec) -> handle | nil, err -- -- startspec = { |
