@@ -1262,16 +1262,19 @@ impl ComponentState {
12621262 func_ty_index,
12631263 table_index,
12641264 } => self . thread_new_indirect ( func_ty_index, table_index, types, offset) ,
1265- CanonicalFunction :: ThreadSwitchTo { cancellable } => {
1266- self . thread_switch_to ( cancellable, types, offset)
1265+ CanonicalFunction :: ThreadSuspendToSuspended { cancellable } => {
1266+ self . thread_suspend_to_suspended ( cancellable, types, offset)
12671267 }
12681268 CanonicalFunction :: ThreadSuspend { cancellable } => {
12691269 self . thread_suspend ( cancellable, types, offset)
12701270 }
1271- CanonicalFunction :: ThreadResumeLater => self . thread_resume_later ( types, offset) ,
1271+ CanonicalFunction :: ThreadSuspendTo { cancellable } => {
1272+ self . thread_suspend_to ( cancellable, types, offset)
1273+ }
1274+ CanonicalFunction :: ThreadUnsuspend => self . thread_unsuspend ( types, offset) ,
12721275
1273- CanonicalFunction :: ThreadYieldTo { cancellable } => {
1274- self . thread_yield_to ( cancellable, types, offset)
1276+ CanonicalFunction :: ThreadYieldToSuspended { cancellable } => {
1277+ self . thread_yield_to_suspended ( cancellable, types, offset)
12751278 }
12761279 }
12771280 }
@@ -2176,7 +2179,7 @@ impl ComponentState {
21762179 Ok ( ( ) )
21772180 }
21782181
2179- fn thread_switch_to (
2182+ fn thread_suspend_to_suspended (
21802183 & mut self ,
21812184 _cancellable : bool ,
21822185 types : & mut TypeAlloc ,
@@ -2185,7 +2188,7 @@ impl ComponentState {
21852188 if !self . features . cm_threading ( ) {
21862189 bail ! (
21872190 offset,
2188- "`thread.switch_to ` requires the component model threading feature"
2191+ "`thread.suspend_to_suspended ` requires the component model threading feature"
21892192 )
21902193 }
21912194
@@ -2211,19 +2214,36 @@ impl ComponentState {
22112214 Ok ( ( ) )
22122215 }
22132216
2214- fn thread_resume_later ( & mut self , types : & mut TypeAlloc , offset : usize ) -> Result < ( ) > {
2217+ fn thread_suspend_to (
2218+ & mut self ,
2219+ _cancellable : bool ,
2220+ types : & mut TypeAlloc ,
2221+ offset : usize ,
2222+ ) -> Result < ( ) > {
2223+ if !self . features . cm_threading ( ) {
2224+ bail ! (
2225+ offset,
2226+ "`thread.suspend_to` requires the component model threading feature"
2227+ )
2228+ }
2229+ self . core_funcs
2230+ . push ( types. intern_func_type ( FuncType :: new ( [ ValType :: I32 ] , [ ValType :: I32 ] ) , offset) ) ;
2231+ Ok ( ( ) )
2232+ }
2233+
2234+ fn thread_unsuspend ( & mut self , types : & mut TypeAlloc , offset : usize ) -> Result < ( ) > {
22152235 if !self . features . cm_threading ( ) {
22162236 bail ! (
22172237 offset,
2218- "`thread.resume_later ` requires the component model threading feature"
2238+ "`thread.unsuspend ` requires the component model threading feature"
22192239 )
22202240 }
22212241 self . core_funcs
22222242 . push ( types. intern_func_type ( FuncType :: new ( [ ValType :: I32 ] , [ ] ) , offset) ) ;
22232243 Ok ( ( ) )
22242244 }
22252245
2226- fn thread_yield_to (
2246+ fn thread_yield_to_suspended (
22272247 & mut self ,
22282248 _cancellable : bool ,
22292249 types : & mut TypeAlloc ,
@@ -2232,7 +2252,7 @@ impl ComponentState {
22322252 if !self . features . cm_threading ( ) {
22332253 bail ! (
22342254 offset,
2235- "`thread.yield_to ` requires the component model threading feature"
2255+ "`thread.yield_to_suspended ` requires the component model threading feature"
22362256 )
22372257 }
22382258 self . core_funcs
0 commit comments