From 1c3a72da46c05caf6749cd97f85f6ee8ef549a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Thu, 31 Oct 2024 00:07:58 +0100 Subject: [PATCH] Regroup all manual threading algorithms into a single module --- src/algorithm.rs | 6 ++---- src/algorithm/{lpt.rs => manual_threading.rs} | 6 ++++++ src/algorithm/single_thread.rs | 7 ------- 3 files changed, 8 insertions(+), 11 deletions(-) rename src/algorithm/{lpt.rs => manual_threading.rs} (90%) delete mode 100644 src/algorithm/single_thread.rs diff --git a/src/algorithm.rs b/src/algorithm.rs index 0ef1550..41ab457 100644 --- a/src/algorithm.rs +++ b/src/algorithm.rs @@ -1,7 +1,5 @@ -mod lpt; +mod manual_threading; mod rayon; -mod single_thread; -pub use lpt::*; +pub use manual_threading::*; pub use rayon::*; -pub use single_thread::single_thread; diff --git a/src/algorithm/lpt.rs b/src/algorithm/manual_threading.rs similarity index 90% rename from src/algorithm/lpt.rs rename to src/algorithm/manual_threading.rs index 1467e5d..dc8719d 100644 --- a/src/algorithm/lpt.rs +++ b/src/algorithm/manual_threading.rs @@ -13,6 +13,12 @@ pub fn multi_threads(data: &[Task]) { run_multi(data); } +pub fn single_thread(data: &[Task]) { + for task in data { + task.execute(); + } +} + #[inline(always)] fn run_multi(data: Vec) { let data_mt = Arc::new(Mutex::new(data)); diff --git a/src/algorithm/single_thread.rs b/src/algorithm/single_thread.rs deleted file mode 100644 index 1bdbe81..0000000 --- a/src/algorithm/single_thread.rs +++ /dev/null @@ -1,7 +0,0 @@ -use crate::Task; - -pub fn single_thread(data: &[Task]) { - for task in data { - task.execute(); - } -}