Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions crates/wasmtime/src/runtime/component/concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,13 @@ impl<T> StoreContextMut<'_, T> {
trap_on_idle: bool,
) -> Result<R> {
debug_assert!(self.0.concurrency_support());
check_recursive_run();
let already_running = self
.0
.concurrent_state_mut_already_forced_current_thread()
.event_loop_running;
if already_running {
bail!("Recursive `StoreContextMut::run_concurrent` calls not supported")
}
let token = StoreToken::new(self.as_context_mut());

struct Dropper<'a, T: 'static, V> {
Expand Down Expand Up @@ -6103,16 +6109,6 @@ fn check_ambient_store(id: StoreId) {
});
}

/// Assert that `StoreContextMut::run_concurrent` has not been called from
/// within an store's event loop.
fn check_recursive_run() {
tls::try_get(|store| {
if !matches!(store, tls::TryGet::None) {
panic!("Recursive `StoreContextMut::run_concurrent` calls not supported")
}
});
}

fn unpack_callback_code(code: u32) -> (u32, u32) {
(code & 0xF, code >> 4)
}
Expand Down
Loading