]> git.sesse.net Git - stockfish/blobdiff - src/thread.h
Sync with master
[stockfish] / src / thread.h
index ba9197ce4aabe43ab316b02f802f8efcdfc1a89a..3f902dc17b794a35250f87759e932dd9f0607bd4 100644 (file)
@@ -37,8 +37,6 @@ struct Thread;
 const int MAX_THREADS = 128;
 const int MAX_SPLITPOINTS_PER_THREAD = 8;
 
-struct Thread;
-
 /// SplitPoint struct stores information shared by the threads searching in
 /// parallel below the same split point. It is populated at splitting time.
 
@@ -75,8 +73,7 @@ struct SplitPoint {
 
 struct ThreadBase {
 
-  ThreadBase() : exit(false) {}
-  virtual ~ThreadBase() {}
+  virtual ~ThreadBase() = default;
   virtual void idle_loop() = 0;
   void notify_one();
   void wait_for(volatile const bool& b);
@@ -84,7 +81,7 @@ struct ThreadBase {
   std::thread nativeThread;
   std::mutex mutex;
   std::condition_variable sleepCondition;
-  volatile bool exit;
+  volatile bool exit = false;
 };
 
 
@@ -120,19 +117,17 @@ struct Thread : public ThreadBase {
 /// special threads: the main one and the recurring timer.
 
 struct MainThread : public Thread {
-  MainThread() : thinking(true) {} // Avoid a race with start_thinking()
   virtual void idle_loop();
-  volatile bool thinking;
+  volatile bool thinking = true; // Avoid a race with start_thinking()
 };
 
 struct TimerThread : public ThreadBase {
 
   static const int Resolution = 5; // Millisec between two check_time() calls
 
-  TimerThread() : run(false) {}
   virtual void idle_loop();
 
-  bool run;
+  bool run = false;
 };