From fb6dd70562e4bc9dba63913dbfe47ad792e0039d Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 17 Oct 2020 22:32:08 +0800 Subject: [PATCH] thread: Remove searchStarted()/searchFinished()/act() --- src/thread.cpp | 14 ++------------ src/thread.h | 18 ++++++++---------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/thread.cpp b/src/thread.cpp index a39651de..80057dbe 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -147,7 +147,6 @@ void Thread::idle_loop() if (exit) return; - emit searchStarted(); lk.unlock(); // TODO: Stockfish doesn't have this @@ -179,8 +178,6 @@ void Thread::idle_loop() #ifdef OPENING_BOOK } #endif - - emit searchFinished(); } loggerDebug("Thread %d quit\n", us); @@ -189,15 +186,6 @@ void Thread::idle_loop() /////////////// -void Thread::act() -{ - if (exit|| !searching) - return; - - std::lock_guard lk(mutex); - clearHistoryScore(); -} - void Thread::setAi(Position *p) { std::lock_guard lk(mutex); @@ -218,10 +206,12 @@ void Thread::setAi(Position *p, int tl) timeLimit = tl; } +#ifdef QT_UI void Thread::emitCommand() { emit command(strCommand); } +#endif // QT_UI #ifdef OPENING_BOOK deque openingBookDeque( diff --git a/src/thread.h b/src/thread.h index 444574fc..3f14b288 100644 --- a/src/thread.h +++ b/src/thread.h @@ -58,6 +58,7 @@ public: int search(); void clear(); void idle_loop(); + void start_searching(); void wait_for_search_finished(); int best_move_count(Move move) const; @@ -138,21 +139,18 @@ public: int us; - Q_OBJECT - private: int timeLimit; + Q_OBJECT + +public: +#ifdef QT_UI + void emitCommand(); +#endif // QT_UI + signals: void command(const string &cmdline, bool update = true); - - void searchStarted(); - void searchFinished(); - -public slots: - void act(); // Force move, not quit thread - void start_searching(); - void emitCommand(); };