X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=ba5d13d5666908e45b0ad8149a51e72b4365f54a;hp=a466df87cbb9a2dfa5fa2b9280a858414de71706;hb=0b36ba74fc0a80388cac43a35962ffc73c01b071;hpb=7ff965eebfbc17d2bb4be9c64d56fecf68615010 diff --git a/src/thread.cpp b/src/thread.cpp index a466df87..ba5d13d5 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -165,8 +165,8 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes // Try to allocate available threads and ask them to start searching setting // 'searching' flag. This must be done under lock protection to avoid concurrent // allocation of the same slave by another master. - Threads.mutex.lock(); - sp.mutex.lock(); + Threads.spinlock.acquire(); + sp.spinlock.acquire(); sp.allSlavesSearching = true; // Must be set under lock protection ++splitPointsSize; @@ -188,8 +188,8 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes // it will instantly launch a search, because its 'searching' flag is set. // The thread will return from the idle loop when all slaves have finished // their work at this split point. - sp.mutex.unlock(); - Threads.mutex.unlock(); + sp.spinlock.release(); + Threads.spinlock.release(); Thread::idle_loop(); // Force a call to base class idle_loop() @@ -202,8 +202,8 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes // We have returned from the idle loop, which means that all threads are // finished. Note that setting 'searching' and decreasing splitPointsSize must // be done under lock protection to avoid a race with Thread::available_to(). - Threads.mutex.lock(); - sp.mutex.lock(); + Threads.spinlock.acquire(); + sp.spinlock.acquire(); searching = true; --splitPointsSize; @@ -213,8 +213,8 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes *bestMove = sp.bestMove; *bestValue = sp.bestValue; - sp.mutex.unlock(); - Threads.mutex.unlock(); + sp.spinlock.release(); + Threads.spinlock.release(); } @@ -353,7 +353,7 @@ void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits, StateStackPtr& states) { wait_for_think_finished(); - SearchTime = Time::now(); // As early as possible + SearchTime = now(); // As early as possible Signals.stopOnPonderhit = Signals.firstRootMove = false; Signals.stop = Signals.failedLowAtRoot = false;