1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

Fix a bogus use of mutex

Spinlock must be used instead.

Tested for no regression at 15+0.05 th 4:

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 25928 W: 4303 L: 4190 D: 17435

No functional change.

Resolves #297
This commit is contained in:
Marco Costalba 2015-03-17 07:31:45 +01:00 committed by Joona Kiiski
parent a4b2eeea75
commit 2e8552db76

View file

@ -1599,7 +1599,7 @@ void Thread::idle_loop() {
&& !(this_sp && this_sp->slavesMask.none()) && !(this_sp && this_sp->slavesMask.none())
&& !searching) && !searching)
{ {
if ( !this_sp if ( !this_sp
&& !Threads.main()->thinking) && !Threads.main()->thinking)
{ {
std::unique_lock<Mutex> lk(mutex); std::unique_lock<Mutex> lk(mutex);
@ -1613,12 +1613,12 @@ void Thread::idle_loop() {
// If this thread has been assigned work, launch a search // If this thread has been assigned work, launch a search
while (searching) while (searching)
{ {
mutex.lock(); spinlock.acquire();
assert(activeSplitPoint); assert(activeSplitPoint);
SplitPoint* sp = activeSplitPoint; SplitPoint* sp = activeSplitPoint;
mutex.unlock(); spinlock.release();
Stack stack[MAX_PLY+4], *ss = stack+2; // To allow referencing (ss-2) and (ss+2) Stack stack[MAX_PLY+4], *ss = stack+2; // To allow referencing (ss-2) and (ss+2)
Position pos(*sp->pos, this); Position pos(*sp->pos, this);