Skip to content

Commit

Permalink
Merge pull request BurntSushi#71 from catchmrbharath/issue46
Browse files Browse the repository at this point in the history
[Fixes BurntSushi#46] Use 1 less worker thread than number of threads
  • Loading branch information
amsharma91 committed Sep 20, 2016
2 parents 9c33b23 + 4bad928 commit e6b6330
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use std::process;
use std::result;
use std::sync::{Arc, Mutex};
use std::thread;
use std::cmp;

use deque::{Stealer, Stolen};
use grep::Grep;
Expand Down Expand Up @@ -102,7 +103,7 @@ fn run(args: Args) -> Result<u64> {

let workq = {
let (workq, stealer) = deque::new();
for _ in 0..args.threads() {
for _ in 0..cmp::max(1, args.threads() - 1) {
let worker = MultiWorker {
chan_work: stealer.clone(),
out: out.clone(),
Expand Down

0 comments on commit e6b6330

Please sign in to comment.