-/// Thread struct is used to keep together all the thread related stuff like locks,
-/// state and especially split points. We also use per-thread pawn and material hash
-/// tables so that once we get a pointer to an entry its life time is unlimited and
-/// we don't have to care about someone changing the entry under our feet.
-
-struct Thread {
-
- enum ThreadState
- {
- INITIALIZING, // Thread is initializing itself
- SEARCHING, // Thread is performing work
- AVAILABLE, // Thread is waiting for work
- BOOKED, // Other thread (master) has booked us as a slave
- WORKISWAITING, // Master has ordered us to start
- TERMINATED // We are quitting and thread is terminated
- };
-
- void wake_up();
- bool cutoff_occurred() const;
- bool is_available_to(int master) const;
-
- SplitPoint splitPoints[MAX_ACTIVE_SPLIT_POINTS];
- MaterialInfoTable materialTable;
- PawnInfoTable pawnTable;
- int maxPly;
- Lock sleepLock;
- WaitCondition sleepCond;
- volatile ThreadState state;
- SplitPoint* volatile splitPoint;
- volatile int activeSplitPoints;
+/// MainThread is a derived class with a specific overload for the main thread
+
+struct MainThread : public Thread {
+ virtual void search();
+
+ bool easyMovePlayed, failedLow;
+ double bestMoveChanges;
+ Value previousMoveScore;