+ return !spCnt || (splitPoints[spCnt - 1].slavesMask & (1ULL << master->idx));
+}
+
+
+// init() is called at startup. Initializes lock and condition variable and
+// launches requested threads sending them immediately to sleep. We cannot use
+// a c'tor becuase Threads is a static object and we need a fully initialized
+// engine at this point due to allocation of endgames in Thread c'tor.
+
+void ThreadPool::init() {
+
+ timer = new Thread(&Thread::timer_loop);
+ threads.push_back(new Thread(&Thread::main_loop));
+ read_uci_options();
+}
+
+
+// exit() cleanly terminates the threads before the program exits.
+
+void ThreadPool::exit() {
+
+ delete timer; // As first becuase check_time() accesses threads data
+
+ for (size_t i = 0; i < threads.size(); i++)
+ delete threads[i];