Skip to main content

spawn_fifo_blocking

Function spawn_fifo_blocking 

Source
pub async fn spawn_fifo_blocking<R: Send + 'static>(
    f: impl FnOnce() -> R + Send + 'static,
    operation: &'static str,
) -> Result<R, SpawnError>
Expand description

Spawn a blocking function on the Rayon thread pool (FIFO scheduling).

Uses FIFO scheduling which prevents starvation of older tasks. This is the preferred variant for packet decoding and similar ordered workloads.

Includes cooperative cancellation: if the receiver is dropped before the task starts (e.g., timeout), the task is skipped without executing.

ยงErrors

Returns SpawnError::QueueFull if the outstanding task count exceeds the limit.