X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.h;h=8169407e09b0766e7d4edb4d556727a6b5b2ea17;hp=7557c0e7a90a80695dc37ae10aae4d2d8b08867a;hb=899a2c033e2e74d3da97c7aefff74fb05a59db0a;hpb=55948623e7b8ad1fc6624cd06733b16d295eecb8 diff --git a/src/thread.h b/src/thread.h index 7557c0e7..8169407e 100644 --- a/src/thread.h +++ b/src/thread.h @@ -67,7 +67,6 @@ struct SplitPoint { Depth depth; Value beta; int nodeType; - Move threatMove; bool cutNode; // Const pointers to shared data @@ -114,11 +113,11 @@ struct Thread : public ThreadBase { Thread(); virtual void idle_loop(); bool cutoff_occurred() const; - bool is_available_to(Thread* master) const; + bool available_to(const Thread* master) const; template - void split(Position& pos, Search::Stack* ss, Value alpha, Value beta, Value* bestValue, Move* bestMove, - Depth depth, Move threatMove, int moveCount, MovePicker* movePicker, int nodeType, bool cutNode); + void split(Position& pos, const Search::Stack* ss, Value alpha, Value beta, Value* bestValue, Move* bestMove, + Depth depth, int moveCount, MovePicker* movePicker, int nodeType, bool cutNode); SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD]; Material::Table materialTable; @@ -143,24 +142,25 @@ struct MainThread : public Thread { }; struct TimerThread : public ThreadBase { - TimerThread() : msec(0) {} + TimerThread() : run(false) {} virtual void idle_loop(); - int msec; + bool run; + static const int Resolution = 5; // msec between two check_time() calls }; /// ThreadPool struct handles all the threads related stuff like init, starting, -/// parking and, the most important, launching a slave thread at a split point. +/// parking and, most importantly, launching a slave thread at a split point. /// All the access to shared thread data is done through this class. struct ThreadPool : public std::vector { void init(); // No c'tor and d'tor, threads rely on globals that should - void exit(); // be initialized and valid during the whole thread lifetime. + void exit(); // be initialized and are valid during the whole thread lifetime. MainThread* main() { return static_cast((*this)[0]); } void read_uci_options(); - Thread* available_slave(Thread* master) const; + Thread* available_slave(const Thread* master) const; void wait_for_think_finished(); void start_thinking(const Position&, const Search::LimitsType&, const std::vector&, Search::StateStackPtr&);