mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Do not sleep, but yield
During the search, do not block on condition variable, but instead use std::this_thread::yield(). Clear gain with 16 threads. Again results vary highly depending on hardware, but on average it's a clear gain. ELO: 12.17 +-4.3 (95%) LOS: 100.0% Total: 7998 W: 1407 L: 1127 D: 5464 There is no functional change in single thread mode Resolves #294
This commit is contained in:
@@ -184,8 +184,6 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes
|
||||
}
|
||||
|
||||
slave->allocMutex.unlock();
|
||||
|
||||
slave->notify_one(); // Could be sleeping
|
||||
}
|
||||
|
||||
// Everything is set up. The master thread enters the idle loop, from which
|
||||
@@ -375,5 +373,7 @@ void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits,
|
||||
RootMoves.push_back(RootMove(m));
|
||||
|
||||
main()->thinking = true;
|
||||
main()->notify_one(); // Starts main thread
|
||||
|
||||
for (Thread* th : *this)
|
||||
th->notify_one();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user