aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-08-15 03:07:32 +0300
committereug-vs <eugene@eug-vs.xyz>2023-08-15 03:07:32 +0300
commit369f52284a6443c599c15bf9d0bf2206a489452d (patch)
treedcadcfa5c31be7bb34286bf223f1919cb71b1f52
parenta6874ef87f2a219a5fd1d0533d4d0b60d474939b (diff)
downloadchessnost-369f52284a6443c599c15bf9d0bf2206a489452d.tar.gz
fix: resolve getting stuck before checkmate
-rw-r--r--src/grossmeister/UCI.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/grossmeister/UCI.rs b/src/grossmeister/UCI.rs
index e88d970..1997221 100644
--- a/src/grossmeister/UCI.rs
+++ b/src/grossmeister/UCI.rs
@@ -172,6 +172,9 @@ impl Grossmeister {
fn create_search_thread(&self, depth: u8, duration: Duration) -> JoinHandle<Self> {
let ordering = std::sync::atomic::Ordering::Relaxed;
let should_halt = self.should_halt.clone();
+ // Make sure we don't halt right away
+ should_halt.store(false, std::sync::atomic::Ordering::Relaxed);
+
let should_terminate = Arc::new(AtomicBool::new(true));
if duration < Duration::MAX {