task::spawn now uses a std thread instead of rayon

This commit is contained in:
Filipe Rodrigues 2021-06-05 17:29:17 +01:00
parent 88f80c5762
commit 9930d72dfe

View File

@ -6,6 +6,7 @@ use std::{
pin::Pin,
sync::{Arc, Mutex},
task::Poll,
thread,
};
/// Spawns a task and returns a future for awaiting it's value
@ -18,7 +19,8 @@ pub fn spawn<T: Send + 'static>(f: impl FnOnce() -> T + Send + 'static) -> Value
};
// Spawn the task
rayon::spawn(move || {
// TODO: If not null, maybe use a threadpool for small tasks?
thread::spawn(move || {
let value = f();
*mutex.lock().expect("Poisoned") = Some(value);
});