Skip to main content

try_block_on_dyn

Function try_block_on_dyn 

Source
pub fn try_block_on_dyn(
    future: Pin<&mut dyn Future<Output = ()>>,
) -> Result<(), RuntimeConfigError>
Expand description

Drive a borrowed future without consuming it when admission or shutdown fails.

On a wasm target, prefer this over block_on / block_on_dyn – see try_spawn for why.

Under RuntimeFlavor::MultiThread this parks the CALLING thread on memory.atomic.wait32, which a browser main thread is forbidden to do (emnapi answers napi_would_deadlock there). The threaded wasm artifact is a Node / WebContainer target today; inside a Worker it is fine.