From 4b8d56098fb7f6ff2d2c394d098d6ec18ddf1f8c Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Thu, 8 Sep 2022 09:49:12 +0530 Subject: [PATCH] uncomment some of the threads examples they don't run yet because of some stack size thing --- src/bin/std_arc.rs | 4 +--- src/bin/std_hash_alt_key_types.rs | 9 ++++----- src/bin/std_misc_channels.rs | 4 +--- src/bin/std_misc_process.rs | 10 +++++----- src/bin/std_misc_threads.rs | 9 ++++----- src/bin/std_misc_threads_testcase_mapreduce.rs | 4 +--- 6 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/bin/std_arc.rs b/src/bin/std_arc.rs index 7ba4eaf..c1bf6b7 100644 --- a/src/bin/std_arc.rs +++ b/src/bin/std_arc.rs @@ -1,6 +1,5 @@ // ./src/std/arc.md -/* use std::time::Duration; use std::sync::Arc; use std::thread; @@ -24,9 +23,8 @@ fn part0() { // Make sure all Arc instances are printed from spawned threads. thread::sleep(Duration::from_secs(1)); } -*/ pub fn main() { - // part0(); + part0(); } diff --git a/src/bin/std_hash_alt_key_types.rs b/src/bin/std_hash_alt_key_types.rs index d87538c..aa99fe6 100644 --- a/src/bin/std_hash_alt_key_types.rs +++ b/src/bin/std_hash_alt_key_types.rs @@ -1,6 +1,5 @@ // ./src/std/hash/alt_key_types.md -/* use std::collections::HashMap; // Eq requires that you derive PartialEq on the type. @@ -56,9 +55,9 @@ fn part0(){ try_logon(&accounts, "j.everyman", "psasword123"); try_logon(&accounts, "j.everyman", "password123"); -}*/ - -pub fn main() { - // part0(); +} + +pub fn main() { + part0(); } diff --git a/src/bin/std_misc_channels.rs b/src/bin/std_misc_channels.rs index f6061e1..b385ee2 100644 --- a/src/bin/std_misc_channels.rs +++ b/src/bin/std_misc_channels.rs @@ -1,6 +1,5 @@ // ./src/std_misc/channels.md -/* use std::sync::mpsc::{Sender, Receiver}; use std::sync::mpsc; use std::thread; @@ -48,9 +47,8 @@ fn part0() { // Show the order in which the messages were sent println!("{:?}", ids); } -*/ pub fn main() { - // part0(); + part0(); } diff --git a/src/bin/std_misc_process.rs b/src/bin/std_misc_process.rs index 0ee81cc..891d1cc 100644 --- a/src/bin/std_misc_process.rs +++ b/src/bin/std_misc_process.rs @@ -2,7 +2,7 @@ use std::process::Command; -/* + fn part0() { let output = Command::new("rustc") .arg("--version") @@ -19,9 +19,9 @@ fn part0() { print!("rustc failed and stderr was:\n{}", s); } -}*/ - -pub fn main() { - // part0(); +} + +pub fn main() { + part0(); } diff --git a/src/bin/std_misc_threads.rs b/src/bin/std_misc_threads.rs index 5f93be8..c5dc1ef 100644 --- a/src/bin/std_misc_threads.rs +++ b/src/bin/std_misc_threads.rs @@ -1,6 +1,5 @@ // ./src/std_misc/threads.md -/* use std::thread; const NTHREADS: u32 = 10; @@ -21,9 +20,9 @@ fn part0() { // Wait for the thread to finish. Returns a result. let _ = child.join(); } -} */ - -pub fn main() { - // part0(); +} + +pub fn main() { + part0(); } diff --git a/src/bin/std_misc_threads_testcase_mapreduce.rs b/src/bin/std_misc_threads_testcase_mapreduce.rs index aaf57b9..b2fb9c3 100644 --- a/src/bin/std_misc_threads_testcase_mapreduce.rs +++ b/src/bin/std_misc_threads_testcase_mapreduce.rs @@ -1,6 +1,5 @@ // ./src/std_misc/threads/testcase_mapreduce.md -/* use std::thread; // This is the `main` thread @@ -92,10 +91,9 @@ fn part0() { println!("Final sum result: {}", final_result); } -*/ pub fn main() { - // part0(); + part0(); }