mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Fix some races and clarify the code
Better split code that should be run at startup from code run at ucinewgame. Also fix several races when 'bench', 'perft' and 'ucinewgame' are sent just after 'bestomve' from the engine threads are still running. Also use a specific UI thread instead of main thread when setting up the Position object used by UI uci loop. This fixes a race when sending 'eval' command while searching. We accept a race on 'setoption' to allow the GUI to change an option while engine is searching withouth stalling the pipe. Note that changing an option while searchingg is anyhow not mandated by UCI protocol. No functional change.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "position.h"
|
||||
#include "search.h"
|
||||
#include "thread.h"
|
||||
#include "tt.h"
|
||||
#include "uci.h"
|
||||
#include "syzygy/tbprobe.h"
|
||||
|
||||
@@ -42,7 +43,10 @@ int main(int argc, char* argv[]) {
|
||||
Bitbases::init();
|
||||
Search::init();
|
||||
Pawns::init();
|
||||
Tablebases::init(Options["SyzygyPath"]);
|
||||
TT.resize(Options["Hash"]);
|
||||
Threads.init();
|
||||
Search::clear(); // After threads are up
|
||||
|
||||
UCI::loop(argc, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user