From 5a2d525048ca5eec1d5d0effc8868cb2fdc701bb Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Fri, 6 Apr 2012 14:17:08 +0100 Subject: [PATCH] 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 --- src/thread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/thread.cpp b/src/thread.cpp index 5136a233..faa3a571 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -210,6 +210,7 @@ void ThreadsManager::init() { lock_init(splitLock); timer = new Thread(&Thread::timer_loop); threads.push_back(new Thread(&Thread::main_loop)); + set_this_thread(main_thread()); // Use main thread's resources read_uci_options(); } @@ -313,7 +314,7 @@ Value ThreadsManager::split(Position& pos, Stack* ss, Value alpha, Value beta, assert(beta <= VALUE_INFINITE); assert(depth > DEPTH_ZERO); - Thread* master = Threads.this_thread(); + Thread* master = this_thread(); if (master->splitPointsCnt >= MAX_SPLITPOINTS_PER_THREAD) return bestValue; -- 2.39.2