We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 798fdfe commit 129f1e6Copy full SHA for 129f1e6
src/evaluate.rs
@@ -85,7 +85,10 @@ impl Evaluator {
85
#[cfg(feature = "parallel")]
86
pub fn get_best_candidate(self) -> Option<Candidate> {
87
let (eval_send, eval_recv) = self.eval_channel;
88
- drop(eval_send); // disconnect the sender, breaking the loop in the thread
+ // Disconnect the sender, breaking the loop in the thread
89
+ drop(eval_send);
90
+ // Yield to ensure evaluations are finished - this can prevent deadlocks when run within an existing thread pool
91
+ while let Some(rayon::Yield::Executed) = rayon::yield_local() {}
92
eval_recv.into_iter().min_by_key(Candidate::cmp_key)
93
}
94
0 commit comments