+ if (token == "quit" || token == "stop")
+ {
+ Search::Signals.stop = true;
+ Threads.wait_for_search_finished(); // Cannot quit while threads are running
+ }
+
+ else if (token == "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.
+ Search::Limits.ponder = false;
+
+ if (Search::Signals.stopOnPonderhit)
+ {
+ Search::Signals.stop = true;
+ Threads.wait_for_search_finished(); // Wake up if is sleeping
+ }
+ }