summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-07-17 19:24:36 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-07-17 19:32:11 +0200
commit3d5708e003564ebfef57da2521ac33b8fe8a49a2 (patch)
tree13b6216c626a92e123c52f49a51b7309dece3421
parentcd5cc0eb87ef7ddad7a2602b911a67a7c7fa9e37 (diff)
Remove dead code
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--ui/src/workers.rs68
1 files changed, 0 insertions, 68 deletions
diff --git a/ui/src/workers.rs b/ui/src/workers.rs
index 7279f49d..f4b71afa 100644
--- a/ui/src/workers.rs
+++ b/ui/src/workers.rs
@@ -19,20 +19,6 @@ impl WorkController {
}
}
-/*
-impl Drop for WorkController {
- fn drop(&mut self) {
- for _ in 0..self.threads.len() {
- self.thread_end_tx.send(true);
- }
- let threads = mem::replace(&mut self.threads, Vec::new());
- for handle in threads {
- handle.join().unwrap();
- }
- }
-}
-*/
-
// We need a way to keep track of what work needs to be done.
// This is a multi-source, multi-consumer queue which we call a
// WorkQueue.
@@ -243,58 +229,4 @@ impl WorkController {
}
}
}
-/*
-pub fn add_jobkk
-
- println!("Adding jobs to the queue.");
- // Variables to keep track of the number of jobs we expect to do.
- let mut jobs_remaining = 0;
- let mut jobs_total = 0;
-
- // Just add some numbers to the queue.
- // These numbers will be passed into fib(), so they need to stay pretty
- // small.
- for work in 0..90 {
- // Add each one several times.
- for _ in 0..100 {
- jobs_remaining = queue.add_work(work);
- jobs_total += 1;
- }
- }
-
-
- // Report that some jobs were inserted, and how many are left to be done.
- // This is interesting because the workers have been taking jobs out of the queue
- // the whole time the control thread has been putting them in!
- //
- // Try removing the use of std::thread::yield_now() in the thread closure.
- // You'll probably (depending on your system) notice that the number remaining
- // after insertion goes way up. That's because the operating system is usually
- // (not always, but usually) fairly conservative about interrupting a thread
- // that is actually doing work.
- //
- // Similarly, if you add a call to yield_now() in the loop above, you'll see the
- // number remaining probably drop to 1 or 2. This can also change depending on
- // how optimized the output code is - try `cargo run --release` vs `cargo run`.
- //
- // This inconsistency should drive home to you that you as the programmer can't
- // make any assumptions at all about when and in what order things will happen
- // in parallel code unless you use thread control primatives as demonstrated
- // in this program.
- println!("Total of {} jobs inserted into the queue ({} remaining at this time).",
- jobs_total,
- jobs_remaining);
-
-
- // Get completed work from the channel while there's work to be done.
- while jobs_total > 0 {
- match results_rx.recv() {
- // If the control thread successfully receives, a job was completed.
- Ok(_) => { jobs_total -= 1 },
- // If the control thread is the one left standing, that's pretty
- // problematic.
- Err(_) => {panic!("All workers died unexpectedly.");}
- }
- }
-*/