mirror of https://github.com/smol-rs/smol
Run the process driver on the executor thread
This allows us to avoid spawning an additional thread in some cases. Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
parent
19ca79660f
commit
75c8dcedfa
|
@ -49,7 +49,11 @@ pub fn spawn<T: Send + 'static>(future: impl Future<Output = T> + Send + 'static
|
|||
.expect("cannot spawn executor thread");
|
||||
}
|
||||
|
||||
Executor::new()
|
||||
// Prevent spawning another thread by running the process driver on this thread.
|
||||
let ex = Executor::new();
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
ex.spawn(async_process::driver()).detach();
|
||||
ex
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue