logo

Function bastion_executor::pool::spawn[][src]

pub fn spawn<F, T>(future: F, stack: ProcStack) -> RecoverableHandle<T> where
    F: Future<Output = T> + Send + 'static,
    T: Send + 'static, 
Expand description

Spawn a process (which contains future + process stack) onto the executor from the global level.

Example

use bastion_executor::prelude::*;
use lightproc::prelude::*;

let pid = 1;
let stack = ProcStack::default().with_pid(pid);

let handle = spawn(
    async {
        panic!("test");
    },
    stack.clone(),
);

run(
    async {
        handle.await;
    },
    stack.clone(),
);