]> git.sesse.net Git - stockfish/commitdiff
Simplify start_searching() signature
authorMarco Costalba <mcostalba@gmail.com>
Mon, 26 Mar 2012 17:56:48 +0000 (18:56 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 26 Mar 2012 17:59:01 +0000 (18:59 +0100)
Retire the "sync" behaviour that now is up to
the caller to honour.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/benchmark.cpp
src/thread.cpp
src/thread.h
src/uci.cpp

index 9f0ac0c145b220798eaab1449e8b848f3c411b94..35fd725443ae6f55aacff6193cd9bf44f30dde36 100644 (file)
@@ -119,6 +119,7 @@ void benchmark(int argc, char* argv[]) {
       else
       {
           Threads.start_searching(pos, limits);
+          Threads.wait_for_search_finished();
           nodes += Search::RootPosition.nodes_searched();
       }
   }
index 65d01d9100a874e19db9addea3772bafa735dd69..10f432bd71bdf81b30af7eafdf7ff2606d046cc9 100644 (file)
@@ -424,13 +424,11 @@ void ThreadsManager::wait_for_search_finished() {
 }
 
 
-// ThreadsManager::start_searching() is used by UI thread to wake up the main
-// thread parked in main_loop() and starting a new search. If async is true
-// then function returns immediately, otherwise caller is blocked waiting for
-// the search to finish.
+// ThreadsManager::start_searching() wakes up the main thread sleeping in
+// main_loop() so to start a new search, then returns immediately.
 
 void ThreadsManager::start_searching(const Position& pos, const LimitsType& limits,
-                                     const std::set<Move>& searchMoves, bool async) {
+                                     const std::set<Move>& searchMoves) {
   wait_for_search_finished();
 
   Signals.stopOnPonderhit = Signals.firstRootMove = false;
@@ -444,8 +442,5 @@ void ThreadsManager::start_searching(const Position& pos, const LimitsType& limi
       if (searchMoves.empty() || searchMoves.count(ml.move()))
           RootMoves.push_back(RootMove(ml.move()));
 
-  threads[0]->wake_up(); // Start main thread
-
-  if (!async)
-      wait_for_search_finished();
+  threads[0]->wake_up();
 }
index e6a4cf95744ca0260f2ae11fd7c58aa7a1dae169..9b0a8bcf7965d42ba2e226d43a894b06afcb1b63 100644 (file)
@@ -126,7 +126,7 @@ public:
   void set_timer(int msec);
   void wait_for_search_finished();
   void start_searching(const Position& pos, const Search::LimitsType& limits,
-                       const std::set<Move>& = std::set<Move>(), bool async = false);
+                       const std::set<Move>& = std::set<Move>());
 
   template <bool Fake>
   Value split(Position& pos, Search::Stack* ss, Value alpha, Value beta, Value bestValue, Move* bestMove,
index 0057881b010a812404e1e7d94c87166805f8a007..7c2bd1e5696cfccb68f2842700868fb52f8c1cbe 100644 (file)
@@ -228,7 +228,7 @@ namespace {
     limits.time = time[pos.side_to_move()];
     limits.increment = inc[pos.side_to_move()];
 
-    Threads.start_searching(pos, limits, searchMoves, true);
+    Threads.start_searching(pos, limits, searchMoves);
   }