mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Introduce yielding spin locks
Idea and original implementation by Stephane Nicolet 7 threads 15+0.05 ELO: 3.54 +-2.9 (95%) LOS: 99.2% Total: 17971 W: 2976 L: 2793 D: 12202 There is no functional change in single thread mode
This commit is contained in:
@@ -174,17 +174,18 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes
|
||||
while ( sp.slavesMask.count() < MAX_SLAVES_PER_SPLITPOINT
|
||||
&& (slave = Threads.available_slave(&sp)) != nullptr)
|
||||
{
|
||||
slave->mutex.lock();
|
||||
slave->allocMutex.lock();
|
||||
|
||||
if (slave->can_join(activeSplitPoint))
|
||||
{
|
||||
activeSplitPoint->slavesMask.set(slave->idx);
|
||||
slave->activeSplitPoint = activeSplitPoint;
|
||||
slave->searching = true;
|
||||
slave->sleepCondition.notify_one(); // Could be sleeping
|
||||
}
|
||||
|
||||
slave->mutex.unlock();
|
||||
slave->allocMutex.unlock();
|
||||
|
||||
slave->notify_one(); // Could be sleeping
|
||||
}
|
||||
|
||||
// Everything is set up. The master thread enters the idle loop, from which
|
||||
|
||||
Reference in New Issue
Block a user