- std::thread nativeThread;
- Mutex mutex;
- ConditionVariable sleepCondition;
- bool exit, searching;
-
-public:
- Thread();
- virtual ~Thread();
- virtual void search();
- void idle_loop();
- void start_searching(bool resume = false);
- void wait_for_search_finished();
- void wait(std::atomic_bool& condition);
-
- Pawns::Table pawnsTable;
- Material::Table materialTable;
- Endgames endgames;
- size_t idx, PVIdx;
- int maxPly;
- std::atomic<uint64_t> nodes, tbHits;
-
- Position rootPos;
- Search::RootMoves rootMoves;
- Depth rootDepth;
- Depth completedDepth;
- CounterMoveStat counterMoves;
- ButterflyHistory history;
- CounterMoveHistoryStat counterMoveHistory;
+ std::mutex mutex;
+ std::condition_variable cv;
+ size_t idx;
+ bool exit = false, searching = true; // Set before starting std::thread
+ NativeThread stdThread;
+
+ public:
+ explicit Thread(size_t);
+ virtual ~Thread();
+ virtual void search();
+ void clear();
+ void idle_loop();
+ void start_searching();
+ void wait_for_search_finished();
+ size_t id() const { return idx; }
+
+ size_t pvIdx, pvLast;
+ std::atomic<uint64_t> nodes, tbHits, bestMoveChanges;
+ int selDepth, nmpMinPly;
+ Value bestValue, optimism[COLOR_NB];
+
+ Position rootPos;
+ StateInfo rootState;
+ Search::RootMoves rootMoves;
+ Depth rootDepth, completedDepth;
+ Value rootDelta;
+ Value rootSimpleEval;
+ CounterMoveHistory counterMoves;
+ ButterflyHistory mainHistory;
+ CapturePieceToHistory captureHistory;
+ ContinuationHistory continuationHistory[2][2];
+ PawnHistory pawnHistory;