+#include "thread_win32.h"
+
+
+/// Thread class keeps together all the thread-related stuff. We 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.
+
+class Thread {
+
+ Mutex mutex;
+ ConditionVariable cv;
+ size_t idx;
+ bool exit = false, searching = true; // Set before starting std::thread
+ std::thread stdThread;
+
+public:
+ explicit Thread(size_t);
+ virtual ~Thread();
+ virtual void search();
+ void clear();
+ void idle_loop();
+ void start_searching();
+ void wait_for_search_finished();
+
+ Pawns::Table pawnsTable;
+ Material::Table materialTable;
+ Endgames endgames;
+ size_t PVIdx;
+ int selDepth, nmp_ply, nmp_odd;
+ std::atomic<uint64_t> nodes, tbHits;
+
+ Position rootPos;
+ Search::RootMoves rootMoves;
+ Depth rootDepth, completedDepth;
+ CounterMoveHistory counterMoves;
+ ButterflyHistory mainHistory;
+ CapturePieceToHistory captureHistory;
+ ContinuationHistory contHistory;
+};
+