Skip to main content

run

Function run 

Source
pub fn run<F: FnOnce() + Send + 'static>(f: F)
Expand description

Initialise the go-lib scheduler and run f as the first goroutine.

Blocks the calling thread until f returns. The scheduler threads (one per logical CPU) continue running in the background after run returns; they park themselves when there is no more work.

ยงExample

go_lib::run(|| {
    println!("hello from a goroutine");
});