X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.h;h=c5690a02634885f5abdf69171660317a45721bbf;hp=645482673ba1b93fbc1dfe9449b329aee0abf049;hb=df201175c6a0704800b1578e338c6e2a202234fe;hpb=800410eef1c0811d046ee2332b3afda21284b876 diff --git a/src/thread.h b/src/thread.h index 64548267..c5690a02 100644 --- a/src/thread.h +++ b/src/thread.h @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008-2013 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2008-2014 Marco Costalba, Joona Kiiski, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,7 +67,6 @@ struct SplitPoint { Depth depth; Value beta; int nodeType; - Move threatMove; bool cutNode; // Const pointers to shared data @@ -114,21 +113,17 @@ struct Thread : public ThreadBase { Thread(); virtual void idle_loop(); bool cutoff_occurred() const; - bool is_available_to(const Thread* master) const; - ExtMove* get_moves_array() { return &movePages[curPage += MAX_MOVES]; } - void free_moves_array() { curPage -= MAX_MOVES; } + bool available_to(const Thread* master) const; template void split(Position& pos, const Search::Stack* ss, Value alpha, Value beta, Value* bestValue, Move* bestMove, - Depth depth, Move threatMove, int moveCount, MovePicker* movePicker, int nodeType, bool cutNode); + Depth depth, int moveCount, MovePicker* movePicker, int nodeType, bool cutNode); SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD]; Material::Table materialTable; Endgames endgames; Pawns::Table pawnsTable; Position* activePosition; - std::vector movePages; - int curPage; size_t idx; int maxPly; SplitPoint* volatile activeSplitPoint; @@ -147,20 +142,21 @@ 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();