X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fthread.h;h=d1328daad91b9818859660e6adc18f0f83652b07;hb=4b19430103ac75b574a6b269db447d359814b603;hp=73be23f108c509e8a23bd0c05c322a771d7b66c3;hpb=7c1f8dbde93267c7958a4de5e167a43e38c9e1e9;p=stockfish diff --git a/src/thread.h b/src/thread.h index 73be23f1..d1328daa 100644 --- a/src/thread.h +++ b/src/thread.h @@ -67,14 +67,11 @@ struct SplitPoint { class Thread { - Thread(const Thread&); // Only declared to disable the default ones - Thread& operator=(const Thread&); // that are not suitable in this case. - - typedef void (Thread::* Fn) (); + typedef void (Thread::* Fn) (); // Pointer to member function public: Thread(Fn fn); - ~Thread(); + ~Thread(); void wake_up(); bool cutoff_occurred() const; @@ -88,7 +85,7 @@ public: SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD]; MaterialTable materialTable; PawnTable pawnTable; - int idx; + size_t idx; int maxPly; Lock sleepLock; WaitCondition sleepCond; @@ -107,18 +104,15 @@ public: /// All the access to shared thread data is done through this class. class ThreadPool { - /* As long as the single ThreadPool object is defined as a global we don't - need to explicitly initialize to zero its data members because variables with - static storage duration are automatically set to zero before enter main() - */ + public: - void init(); // No c'tor becuase Threads is global and we need engine initialized + void init(); // No c'tor, Threads object is global and engine shall be fully initialized ~ThreadPool(); Thread& operator[](int id) { return *threads[id]; } bool use_sleeping_threads() const { return useSleepingThreads; } int min_split_depth() const { return minimumSplitDepth; } - int size() const { return (int)threads.size(); } + size_t size() const { return threads.size(); } Thread* main_thread() { return threads[0]; } void wake_up() const;