Skip to content

Commit

Permalink
Fix stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vinc committed Oct 14, 2017
1 parent 4b2c53e commit b14a293
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,22 +413,24 @@ impl Search for Game {
let mut children = vec![];
for i in 0..concurrency {
let mut clone = self.clone();
//clone.tt = self.tt.clone();
if i > 0 {
clone.is_verbose = false;
clone.is_debug = false;
}
children.push(thread::spawn(move || {
let builder = thread::Builder::new().
name(format!("search_{}", i)).
stack_size(4 << 20);
children.push(builder.spawn(move || {
clone.root(max_depth)
}));
}).unwrap());
}

let mut results = vec![];
let mut res = vec![];
for child in children {
results.push(child.join().unwrap());
res.push(child.join().unwrap());
}

results[0]
res[0] // best move found by the first thread
}

fn print_thinking(&mut self, depth: usize, score: Score, m: Move) {
Expand Down

0 comments on commit b14a293

Please sign in to comment.