mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-25 03:26:24 +08:00
Always flush sfen writer at the end of gensfen and when it is destroyed.
This commit is contained in:
@@ -61,6 +61,8 @@ namespace Learner
|
||||
|
||||
~SfenWriter()
|
||||
{
|
||||
flush();
|
||||
|
||||
finished = true;
|
||||
file_worker_thread.join();
|
||||
output_file_stream.reset();
|
||||
@@ -105,8 +107,16 @@ namespace Learner
|
||||
}
|
||||
}
|
||||
|
||||
void flush()
|
||||
{
|
||||
for (size_t i = 0; i < sfen_buffers.size(); ++i)
|
||||
{
|
||||
flush(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Move what remains in the buffer for your thread to a buffer for writing to a file.
|
||||
void finalize(size_t thread_id)
|
||||
void flush(size_t thread_id)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
|
||||
@@ -357,6 +367,8 @@ namespace Learner
|
||||
});
|
||||
Threads.wait_for_workers_finished();
|
||||
|
||||
sfen_writer.flush();
|
||||
|
||||
if (limit % REPORT_STATS_EVERY != 0)
|
||||
{
|
||||
report(limit, limit % REPORT_STATS_EVERY);
|
||||
@@ -842,8 +854,6 @@ namespace Learner
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sfen_writer.finalize(th.thread_idx());
|
||||
}
|
||||
|
||||
void set_gensfen_search_limits()
|
||||
|
||||
Reference in New Issue
Block a user