mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Teach UI thread to use main thread resources
So to avoid a crash when setting the moves in UCI "position startpos moves ...." command. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -210,6 +210,7 @@ void ThreadsManager::init() {
|
|||||||
lock_init(splitLock);
|
lock_init(splitLock);
|
||||||
timer = new Thread(&Thread::timer_loop);
|
timer = new Thread(&Thread::timer_loop);
|
||||||
threads.push_back(new Thread(&Thread::main_loop));
|
threads.push_back(new Thread(&Thread::main_loop));
|
||||||
|
set_this_thread(main_thread()); // Use main thread's resources
|
||||||
read_uci_options();
|
read_uci_options();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +314,7 @@ Value ThreadsManager::split(Position& pos, Stack* ss, Value alpha, Value beta,
|
|||||||
assert(beta <= VALUE_INFINITE);
|
assert(beta <= VALUE_INFINITE);
|
||||||
assert(depth > DEPTH_ZERO);
|
assert(depth > DEPTH_ZERO);
|
||||||
|
|
||||||
Thread* master = Threads.this_thread();
|
Thread* master = this_thread();
|
||||||
|
|
||||||
if (master->splitPointsCnt >= MAX_SPLITPOINTS_PER_THREAD)
|
if (master->splitPointsCnt >= MAX_SPLITPOINTS_PER_THREAD)
|
||||||
return bestValue;
|
return bestValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user