diff --git a/node-graph/libraries/core-types/src/runtime.rs b/node-graph/libraries/core-types/src/runtime.rs index f206045753..b0163fa2b3 100644 --- a/node-graph/libraries/core-types/src/runtime.rs +++ b/node-graph/libraries/core-types/src/runtime.rs @@ -22,6 +22,13 @@ pub trait Runtime { #[derive(Clone)] pub struct RuntimeHandle(pub Arc); +// SAFETY: wasm is single threaded, so the handle never actually crosses a thread. +#[cfg(target_family = "wasm")] +unsafe impl Send for RuntimeHandle {} +// SAFETY: as in Send. +#[cfg(target_family = "wasm")] +unsafe impl Sync for RuntimeHandle {} + impl std::fmt::Debug for RuntimeHandle { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("RuntimeHandle").finish_non_exhaustive() @@ -70,6 +77,13 @@ pub struct GraphRuntime { spawner: S, } +// SAFETY: wasm is single threaded, so the runtime never actually crosses a thread. +#[cfg(target_family = "wasm")] +unsafe impl Send for GraphRuntime {} +// SAFETY: as in Send. +#[cfg(target_family = "wasm")] +unsafe impl Sync for GraphRuntime {} + impl GraphRuntime { pub fn new(spawner: S) -> Self { Self {