Skip to main content

capture_async

Function capture_async 

Source
pub async fn capture_async(
    platform: &impl CapturePlatform,
    store: &impl AppProfileStore,
    cancel: &impl CancelSignal,
    adapters: &[&dyn AppAdapter],
    options: &CaptureOptions,
) -> CaptureOutcome
Expand description

Async wrapper around crate::capture.

On a multi-thread Tokio runtime this uses block_in_place to offload the blocking work to the current thread without stalling other tasks.

On a current-thread (LocalSet) runtime block_in_place is unavailable because there is only one worker thread. In that case the underlying sync call runs directly on the async task thread and will block the executor for its duration. If you are using a current-thread runtime, call the synchronous crate::capture API from a spawn_blocking closure at the call site instead — that avoids blocking all other tasks on the runtime.