Skip to main content

spawn_blocking

Function spawn_blocking 

Source
pub async fn spawn_blocking<F, T>(f: F) -> Result<T, LiteError>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
Expand description

Run a blocking closure off the async runtime.

  • Native: tokio::task::spawn_blocking — moves closure to the blocking pool.
  • WASM: Runs synchronously (WASM has no blocking pool; callers must ensure the closure is fast or use the async StorageEngine path).