From 9930d72dfe904eeb6570de4a927119a8a6f815a4 Mon Sep 17 00:00:00 2001 From: Filipe Rodrigues Date: Sat, 5 Jun 2021 17:29:17 +0100 Subject: [PATCH] `task::spawn` now uses a `std` thread instead of `rayon` --- dcb-util/src/task.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dcb-util/src/task.rs b/dcb-util/src/task.rs index 305c5c2..f164041 100644 --- a/dcb-util/src/task.rs +++ b/dcb-util/src/task.rs @@ -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(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); });