X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.cpp;h=50e8a3bfac4bad1bcf72ee61d79664d2db36fbe8;hp=53e78595045548bed917e75132dfc084c60ed88a;hb=fda0161e3a5295a759f04a0e302567a773f82595;hpb=cf5d683408a2ef8a1c80be9bf7d6790a38b16277 diff --git a/src/tt.cpp b/src/tt.cpp index 53e78595..50e8a3bf 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -24,6 +24,7 @@ #include "bitboard.h" #include "misc.h" +#include "thread.h" #include "tt.h" #include "uci.h" @@ -58,6 +59,8 @@ void TTEntry::save(Key k, Value v, Bound b, Depth d, Move m, Value ev) { void TranspositionTable::resize(size_t mbSize) { + Threads.main()->wait_for_search_finished(); + clusterCount = mbSize * 1024 * 1024 / sizeof(Cluster); free(mem); @@ -84,7 +87,7 @@ void TranspositionTable::clear() { for (size_t idx = 0; idx < Options["Threads"]; idx++) { - threads.push_back(std::thread([this, idx]() { + threads.emplace_back([this, idx]() { // Thread binding gives faster search on systems with a first-touch policy if (Options["Threads"] > 8) @@ -97,7 +100,7 @@ void TranspositionTable::clear() { stride : clusterCount - start; std::memset(&table[start], 0, len * sizeof(Cluster)); - })); + }); } for (std::thread& th: threads)