mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 19:16:49 +08:00
Make next_fen in opening_book a critical section
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace Learner {
|
||||
|
||||
@@ -20,6 +21,8 @@ namespace Learner {
|
||||
{
|
||||
assert(fens.size() > 0);
|
||||
|
||||
std::unique_lock lock(mutex);
|
||||
|
||||
auto& fen = fens[current_index++];
|
||||
if (current_index >= fens.size())
|
||||
current_index = 0;
|
||||
@@ -39,6 +42,7 @@ namespace Learner {
|
||||
}
|
||||
|
||||
|
||||
std::mutex mutex;
|
||||
std::string filename;
|
||||
std::vector<std::string> fens;
|
||||
std::size_t current_index;
|
||||
|
||||
Reference in New Issue
Block a user