@@ -2859,11 +2859,12 @@ impl Instance {
28592859 set : u32 ,
28602860 payload : u32 ,
28612861 ) -> Result < u32 > {
2862+ self . id ( ) . get ( store) . check_may_leave ( caller) ?;
2863+
28622864 if !self . options ( store, options) . async_ {
28632865 store. concurrent_state_mut ( ) . check_blocking ( ) ?;
28642866 }
28652867
2866- self . id ( ) . get ( store) . check_may_leave ( caller) ?;
28672868 let & CanonicalOptions {
28682869 cancellable,
28692870 instance : caller_instance,
@@ -2892,11 +2893,12 @@ impl Instance {
28922893 set : u32 ,
28932894 payload : u32 ,
28942895 ) -> Result < u32 > {
2896+ self . id ( ) . get ( store) . check_may_leave ( caller) ?;
2897+
28952898 if !self . options ( store, options) . async_ {
28962899 store. concurrent_state_mut ( ) . check_blocking ( ) ?;
28972900 }
28982901
2899- self . id ( ) . get ( store) . check_may_leave ( caller) ?;
29002902 let & CanonicalOptions {
29012903 cancellable,
29022904 instance : caller_instance,
@@ -3075,6 +3077,8 @@ impl Instance {
30753077 yielding : bool ,
30763078 to_thread : Option < u32 > ,
30773079 ) -> Result < WaitResult > {
3080+ self . id ( ) . get ( store) . check_may_leave ( caller) ?;
3081+
30783082 if to_thread. is_none ( ) && !yielding {
30793083 // This is a `thread.suspend` call
30803084 store. concurrent_state_mut ( ) . check_blocking ( ) ?;
@@ -3085,8 +3089,6 @@ impl Instance {
30853089 return Ok ( WaitResult :: Cancelled ) ;
30863090 }
30873091
3088- self . id ( ) . get ( store) . check_may_leave ( caller) ?;
3089-
30903092 if let Some ( thread) = to_thread {
30913093 self . resume_suspended_thread ( store, caller, thread, true ) ?;
30923094 }
@@ -3209,11 +3211,12 @@ impl Instance {
32093211 async_ : bool ,
32103212 task_id : u32 ,
32113213 ) -> Result < u32 > {
3214+ self . id ( ) . get ( store) . check_may_leave ( caller_instance) ?;
3215+
32123216 if !async_ {
32133217 store. concurrent_state_mut ( ) . check_blocking ( ) ?;
32143218 }
32153219
3216- self . id ( ) . get ( store) . check_may_leave ( caller_instance) ?;
32173220 let ( rep, is_host) =
32183221 self . id ( ) . get_mut ( store) . guest_tables ( ) . 0 [ caller_instance] . subtask_rep ( task_id) ?;
32193222 let ( waitable, expected_caller_instance) = if is_host {
0 commit comments