X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=f5aab2b13366e3a3850dfb2979080d489c33b648;hp=432d573d42ce2b2746a1f11cac6610979d8097ba;hb=f6e98a924af233a5e69f3494168cf5d80168c705;hpb=8f6a494ad70eccf744c1b03d23313fe06d131ded diff --git a/src/thread.cpp b/src/thread.cpp index 432d573d..f5aab2b1 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -112,9 +112,9 @@ bool Thread::cutoff_occurred() const { // which are busy searching the split point at the top of slave's split point // stack (the "helpful master concept" in YBWC terminology). -bool Thread::available_to(const Thread* master) const { +bool Thread::available_to(const Thread* master, bool latejoin) const { - if (searching) + if (searching && !latejoin) return false; // Make a local copy to be sure it doesn't become zero under our feet while @@ -239,7 +239,7 @@ void ThreadPool::read_uci_options() { Thread* ThreadPool::available_slave(const Thread* master) const { for (const_iterator it = begin(); it != end(); ++it) - if ((*it)->available_to(master)) + if ((*it)->available_to(master, false)) return *it; return NULL; @@ -292,6 +292,7 @@ void Thread::split(Position& pos, const Stack* ss, Value alpha, Value beta, Valu Threads.mutex.lock(); sp.mutex.lock(); + sp.allowLatejoin = true; // Only set this under lock protection ++splitPointsSize; activeSplitPoint = &sp; activePosition = NULL;