pub fn spawn<T, F>(fut: F) -> JoinHandle<T>
where
    F: Future<Output = T> + Send + 'static,
    T: Send + 'static,
{
    let result = std::sync::Arc::new(std::sync::Mutex::new(None));
    let stack_size = ExecutionState::with(|s| s.config.stack_size);
    let task_id = ExecutionState::spawn_future(Wrapper::new(fut, std::sync::Arc::clone(&result)), stack_size, None);
    // TODO I think we need to yield here to give the spawned task a chance to execute before the spawner continues
    JoinHandle { task_id, result }
}
/// Spawn a new async task that the executor will run to completion.
Spawn a new async task that the executor will run to completion.
Spawn a new async task that the executor will run to completion .
pub fn spawn<T, F>(fut: F) -> JoinHandle<T>
where
    F: Future<Output = T> + Send + 'static,
    T: Send + 'static,
{
    let result = std::sync::Arc::new(std::sync::Mutex::new(None));
    let stack_size = ExecutionState::with(|s| s.config.stack_size);
    let task_id = ExecutionState::spawn_future(Wrapper::new(fut, std::sync::Arc::clone(&result)), stack_size, None);
    // TODO I think we need to yield here to give the spawned task a chance to execute before the spawner continues
    JoinHandle { task_id, result }
}
pub fn spawn < T , F > ( fut : F ) -> JoinHandle < T > where F : Future < Output = T > + Send + ' static , T : Send + ' static , { let result = std :: sync :: Arc :: new ( std :: sync :: Mutex :: new ( None ) ) ; let stack_size = ExecutionState :: with ( | s | s . config . stack_size ) ; let task_id = ExecutionState :: spawn_future ( Wrapper :: new ( fut , std :: sync :: Arc :: clone ( & result ) ) , stack_size , None ) ; // TODO I think we need to yield here to give the spawned task a chance to execute before the spawner continues JoinHandle { task_id , result } }
Spawn a new async task that the executor will run to completion.
Spawn a new async task that the executor will run to completion .
fut
F
fut
F