Skip to content

Commit

Permalink
Merge remote-tracking branch 'andrews05/parallel' into pr522+pr524
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr0methean committed Jun 24, 2023
2 parents a688086 + 059e22b commit b870a1b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ impl Evaluator {
#[cfg(feature = "parallel")]
pub fn get_best_candidate(self) -> Option<Candidate> {
let (eval_send, eval_recv) = self.eval_channel;
drop(eval_send); // disconnect the sender, breaking the loop in the thread
// Disconnect the sender, breaking the loop in the thread
drop(eval_send);
// Yield to ensure evaluations are finished - this can prevent deadlocks when run within an existing thread pool
while let Some(rayon::Yield::Executed) = rayon::yield_local() {}
eval_recv.into_iter().min_by_key(Candidate::cmp_key)
}

Expand Down

0 comments on commit b870a1b

Please sign in to comment.