- Lock sleepLock;
- WaitCondition sleepCond;
- volatile ThreadState state;
- SplitPoint* volatile splitPoint;
- volatile int activeSplitPoints;
- volatile bool do_sleep;
- volatile bool do_terminate;
-
-#if defined(_MSC_VER)
- HANDLE handle;
-#else
- pthread_t handle;
-#endif
+ volatile bool searching;
+
+ Position rootPos;
+ Search::RootMoveVector rootMoves;
+ Depth rootDepth;
+ Search::Stack stack[MAX_PLY+4];
+ HistoryStats history;
+ MovesStats counterMoves;
+};
+
+
+/// MainThread and TimerThread are derived classes used to characterize the two
+/// special threads: the main one and the recurring timer.
+
+struct MainThread : public Thread {
+ virtual void idle_loop();
+ void join();
+ void think();
+ volatile bool thinking = true; // Avoid a race with start_thinking()
+};
+
+struct TimerThread : public ThreadBase {
+
+ static const int Resolution = 5; // Millisec between two check_time() calls
+
+ virtual void idle_loop();
+
+ bool run = false;