create_and_spawn

Function create_and_spawn 

Source
pub fn create_and_spawn<G>() -> Result<(JoinHandle<Result<()>>, I2o2Handle<G>)>
where G: Send + 'static,
Expand description

Create a new I2o2Scheduler and I2o2Handle pair backed by io_uring and spawn the scheduler in a background worker thread.

This will use the default settings for the scheduler, you can optionally use the builder to customise the ring behaviour.

NOTE: The scheduler cannot be sent across threads.

ยงExample


let (scheduler_handle, handle) = i2o2::create_and_spawn::<()>()?;

// ... do work