@@ -1464,12 +1464,15 @@ canon ::= ...
14641464 | (canon future.drop-readable <typeidx> (core func <id>?)) 🔀
14651465 | (canon future.drop-writable <typeidx> (core func <id>?)) 🔀
14661466 | (canon thread.index (core func <id>?)) 🧵
1467+ | (canon thread.exit (core func <id>?)) 🧵
14671468 | (canon thread.new-indirect <typeidx> <core:tableidx> (core func <id>?)) 🧵
14681469 | (canon thread.resume-later (core func <id>?)) 🧵
14691470 | (canon thread.suspend cancellable? (core func <id>?)) 🧵
14701471 | (canon thread.yield cancellable? (core func <id>?)) 🔀
1471- | (canon thread.switch-to cancellable? (core func <id>?)) 🧵
1472- | (canon thread.yield-to cancellable? (core func <id>?)) 🧵
1472+ | (canon thread.suspend-then-resume cancellable? (core func <id>?)) 🧵
1473+ | (canon thread.yield-then-resume cancellable? (core func <id>?)) 🧵
1474+ | (canon thread.suspend-then-promote cancellable? (core func <id>?)) 🧵
1475+ | (canon thread.yield-then-promote cancellable? (core func <id>?)) 🧵
14731476 | (canon error-context.new <canonopt>* (core func <id>?)) 📝
14741477 | (canon error-context.debug-message <canonopt>* (core func <id>?)) 📝
14751478 | (canon error-context.drop (core func <id>?)) 📝
@@ -2067,6 +2070,13 @@ learn their index via `thread.index`.
20672070For details, see [ Thread Built-ins] in the concurrency explainer and
20682071[ ` canon_thread_index ` ] in the Canonical ABI explainer.
20692072
2073+ ###### 🧵 ` thread.exit `
2074+
2075+ TODO
2076+
2077+ For details, see [ Thread Built-ins] in the concurrency explainer and
2078+ [ ` canon_thread_exit ` ] in the Canonical ABI explainer.
2079+
20702080###### 🧵 ` thread.new-indirect `
20712081
20722082| Synopsis | |
@@ -2089,7 +2099,7 @@ extended for [GC].
20892099
20902100As explained in the [ concurrency explainer] , a thread created by
20912101` thread.new-indirect ` is initially in a suspended state and must be resumed
2092- eagerly or lazily by [ ` thread.yield-to ` ] ( #-threadyield-to ) or
2102+ eagerly or lazily by [ ` thread.yield-then-resume ` ] ( #-threadyield-then-resume ) or
20932103[ ` thread.resume-later ` ] ( #-threadresume-later ) , resp., to begin execution.
20942104
20952105For details, see [ Thread Built-ins] in the concurrency explainer and
@@ -2122,9 +2132,6 @@ explicitly resumed by some other thread calling a built-in such as
21222132the current task was [ cancelled] by the caller; otherwise, ` thread.suspend `
21232133always returns ` false ` .
21242134
2125- A non-` async ` -typed function export that has not yet returned a value traps if
2126- it transitively attempts to call ` thread.suspend ` .
2127-
21282135For details, see [ Thread Built-ins] in the concurrency explainer and
21292136[ ` canon_thread_suspend ` ] in the Canonical ABI explainer.
21302137
@@ -2138,52 +2145,59 @@ For details, see [Thread Built-ins] in the concurrency explainer and
21382145The ` thread.yield ` built-in allows the runtime to potentially switch to any
21392146other thread in the "ready" state, enabling a long-running computation to
21402147cooperatively interleave execution without specifically requesting another
2141- thread to be resumed (as with ` thread.yield-to ` ). If ` cancellable ` is set,
2142- ` thread.yield ` returns whether the current task was [ cancelled] by the caller;
2143- otherwise, ` thread.yield ` always returns ` false ` .
2144-
2145- If ` thread.yield ` is called from a synchronous- or ` async callback ` -lifted
2146- export, it returns immediately without blocking (instead of trapping, as with
2147- other possibly-blocking operations like ` waitable-set.wait ` ). This is because,
2148- unlike other built-ins, ` thread.yield ` may be scattered liberally throughout
2149- code that might show up in the transitive call tree of a synchronous function
2150- call.
2148+ thread to be resumed (as with ` thread.yield-then-resume ` ). If ` cancellable ` is
2149+ set, ` thread.yield ` returns whether the current task was [ cancelled] by the
2150+ caller; otherwise, ` thread.yield ` always returns ` false ` .
21512151
21522152For details, see [ Thread Built-ins] in the concurrency explainer and
21532153[ ` canon_thread_yield ` ] in the Canonical ABI explainer.
21542154
2155- ###### 🧵 ` thread.switch-to `
2155+ ###### 🧵 ` thread.suspend-then-resume `
21562156
21572157| Synopsis | |
21582158| -------------------------- | --------------------------------------- |
21592159| Approximate WIT signature | ` func<cancellable?>(t: thread) -> bool ` |
21602160| Canonical ABI signature | ` [t:i32] -> [i32] ` |
21612161
2162- The ` thread.switch-to ` built-in suspends the [ current thread] and immediately
2163- resumes execution of the thread ` t ` , trapping if ` t ` is not in a "suspended"
2164- state. If ` cancellable ` is set, ` thread.switch-to ` returns whether the current
2165- task was [ cancelled] by the caller; otherwise, ` thread.switch-to ` always returns
2166- ` false ` .
2162+ The ` thread.suspend-then-resume ` built-in suspends the [ current thread] and
2163+ immediately resumes execution of the thread ` t ` , trapping if ` t ` is not in a
2164+ "suspended" state. If ` cancellable ` is set, ` thread.suspend-then-resume ` returns
2165+ whether the current task was [ cancelled] by the caller; otherwise,
2166+ ` thread.suspend-then-resume ` always returns ` false ` .
21672167
21682168For details, see [ Thread Built-ins] in the concurrency explainer and
2169- [ ` canon_thread_switch_to ` ] in the Canonical ABI explainer.
2169+ [ ` canon_thread_suspend_then_resume ` ] in the Canonical ABI explainer.
21702170
2171- ###### 🧵 ` thread.yield-to `
2171+ ###### 🧵 ` thread.yield-then-resume `
21722172
21732173| Synopsis | |
21742174| -------------------------- | --------------------------------------- |
21752175| Approximate WIT signature | ` func<cancellable?>(t: thread) -> bool ` |
21762176| Canonical ABI signature | ` [t:i32] -> [i32] ` |
21772177
2178- The ` thread.yield-to ` built-in immediately resumes execution of the thread ` t ` ,
2179- (trapping if ` t ` is not in a "suspended" state) leaving the [ current thread] in
2180- a "ready" state so that the runtime can nondeterministically resume the current
2181- thread at some point in the future. If ` cancellable ` is set, ` thread.yield-to `
2182- returns whether the current task was [ cancelled] by the caller; otherwise,
2183- ` thread.yield-to ` always returns ` false ` .
2178+ The ` thread.yield-then-resume ` built-in immediately resumes execution of the
2179+ thread ` t ` , (trapping if ` t ` is not in a "suspended" state) leaving the [ current
2180+ thread] in a "ready" state so that the runtime can nondeterministically resume
2181+ the current thread at some point in the future. If ` cancellable ` is set,
2182+ ` thread.yield-then-resume ` returns whether the current task was [ cancelled] by
2183+ the caller; otherwise, ` thread.yield-then-resume ` always returns ` false ` .
2184+
2185+ For details, see [ Thread Built-ins] in the concurrency explainer and
2186+ [ ` canon_thread_yield_then_resume ` ] in the Canonical ABI explainer.
2187+
2188+ ###### 🧵 ` thread.suspend-then-promote `
2189+
2190+ TODO
2191+
2192+ For details, see [ Thread Built-ins] in the concurrency explainer and
2193+ [ ` canon_thread_suspend_then_promote ` ] in the Canonical ABI explainer.
2194+
2195+ ###### 🧵 ` thread.yield-then-promote `
2196+
2197+ TODO
21842198
21852199For details, see [ Thread Built-ins] in the concurrency explainer and
2186- [ ` canon_thread_yield_to ` ] in the Canonical ABI explainer.
2200+ [ ` canon_thread_yield_then_promote ` ] in the Canonical ABI explainer.
21872201
21882202###### 🧵② ` thread.spawn-ref `
21892203
@@ -3282,12 +3296,15 @@ For some use-case-focused, worked examples, see:
32823296[ `canon_error_context_debug_message` ] : CanonicalABI.md#-canon-error-contextdebug-message
32833297[ `canon_error_context_drop` ] : CanonicalABI.md#-canon-error-contextdrop
32843298[ `canon_thread_index` ] : CanonicalABI.md#-canon-threadindex
3299+ [ `canon_thread_exit` ] : CanonicalABI.md#-canon-threadexit
32853300[ `canon_thread_new_indirect` ] : CanonicalABI.md#-canon-threadnew-indirect
3286- [ `canon_thread_suspend` ] : CanonicalABI.md#-canon-threadsuspend
3287- [ `canon_thread_switch_to` ] : CanonicalABI.md#-canon-threadswitch-to
32883301[ `canon_thread_resume_later` ] : CanonicalABI.md#-canon-threadresume-later
3289- [ `canon_thread_yield_to ` ] : CanonicalABI.md#-canon-threadyield-to
3302+ [ `canon_thread_suspend ` ] : CanonicalABI.md#-canon-threadsuspend
32903303[ `canon_thread_yield` ] : CanonicalABI.md#-canon-threadyield
3304+ [ `canon_thread_suspend_then_resume` ] : CanonicalABI.md#-canon-threadsuspend-then-resume
3305+ [ `canon_thread_yield_then_resume` ] : CanonicalABI.md#-canon-threadyield-then-resume
3306+ [ `canon_thread_suspend_then_promote` ] : CanonicalABI.md#-canon-threadsuspend-then-promote
3307+ [ `canon_thread_yield_then_promote` ] : CanonicalABI.md#-canon-threadyield-then-promote
32913308[ `canon_thread_spawn_ref` ] : CanonicalABI.md#-canon-threadspawn-ref
32923309[ `canon_thread_spawn_indirect` ] : CanonicalABI.md#-canon-threadspawn-indirect
32933310[ `canon_thread_available_parallelism` ] : CanonicalABI.md#-canon-threadavailable_parallelism
0 commit comments