Function mioco::spawn
[−]
[src]
pub fn spawn<F, T>(f: F) -> JoinHandle<T> where F: FnOnce() -> T, F: Send + 'static, T: Send + 'static
Spawn a mioco coroutine.
If called inside an existing mioco instance - spawn and run a new coroutine in it.
If called outside of existing mioco instance - spawn a new mioco instance in a separate thread or use existing mioco instance to run new mioco coroutine. The API intention is to guarantee:
- this call will not block
- coroutine will be executing in some mioco instance
the details on reusing existing mioco instances might change.