by dbaupp · 11y ago · 0 comments
pub fn spawn<F, T>(f: F) -> JoinHandle<T>
where F: Send + 'static + FnOnce() -> T, T: Send + 'static
Other than implementations of `Send`/`Sync` themselves, this is essentially the only function in std that needs to bound by them.The same approach can be used in a kernel context, e.g. place bounds on the functions that create (or, at least, initialise interaction between) concurrently executing pieces of code.