+
+
+// ThreadsManager::do_uci_async_cmd() processes the commands from GUI received
+// by listener thread while the other threads are searching.
+
+void ThreadsManager::do_uci_async_cmd(const std::string& cmd) {
+
+ if (cmd == "quit")
+ {
+ // Quit the program as soon as possible
+ Limits.ponder = false;
+ QuitRequest = StopRequest = true;
+ }
+ else if (cmd == "stop")
+ {
+ // Stop calculating as soon as possible, but still send the "bestmove"
+ // and possibly the "ponder" token when finishing the search.
+ Limits.ponder = false;
+ StopRequest = true;
+ }
+ else if (cmd == "ponderhit")
+ {
+ // The opponent has played the expected move. GUI sends "ponderhit" if
+ // we were told to ponder on the same move the opponent has played. We
+ // should continue searching but switching from pondering to normal search.
+ Limits.ponder = false;
+
+ if (StopOnPonderhit)
+ StopRequest = true;
+ }
+}