mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Wait for main thread to finish before to exit
Currently after a 'quit' command UI thread raises stop signal, exits from uci_loop() and calls Threads.exit() while the search threads are still active. In Threads.exit() main thread is asked to terminate, but if it is parked in idle_loop() it will exit and free its resources (in particular the shared Movepicker object) while sibling slaves are still active and this leads to a crash. The fix is to let the UI thread always wait for main thread to finish the search before to return from uci_loop(). Found by Valgrind when running with 8 threads. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -118,6 +118,7 @@ public:
|
||||
bool split_point_finished(SplitPoint* sp) const;
|
||||
void set_timer(int msec);
|
||||
void wait_for_stop_or_ponderhit();
|
||||
void stop_thinking();
|
||||
void start_thinking(const Position& pos, const Search::LimitsType& limits,
|
||||
const std::vector<Move>& searchMoves, bool asyncMode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user