]> git.sesse.net Git - stockfish/commitdiff
Teach UI thread to use main thread resources
authorMarco Costalba <mcostalba@gmail.com>
Fri, 6 Apr 2012 13:17:08 +0000 (14:17 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 6 Apr 2012 14:05:52 +0000 (15:05 +0100)
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>
src/thread.cpp

index 5136a233db14b819fa7d73d397384f18ba2e176e..faa3a5716aa1570945c5dcaea7cb345ca0e75455 100644 (file)
@@ -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;