Add mutexes to state for the queue and the allocator

Our threads need to negotiate access and mutation to the two
resources - we don't want them treading on each others toes when
generating new child nodes /or/ when trying to remove/add work to the
queue.  The former situation is particularly worrisome due to how weak
the indexing system is with the allocator.
This commit is contained in:
2025-11-27 01:42:24 +00:00
parent 0abd353368
commit 40e07e03f2

View File

@@ -8,6 +8,7 @@
#ifndef STATE_HPP
#define STATE_HPP
#include <mutex>
#include <queue>
#include "base.hpp"
@@ -20,6 +21,9 @@ namespace cw::state
cw::node::NodeAllocator allocator;
std::queue<u64> queue;
std::mutex mutex_queue;
std::mutex mutex_allocator;
State(void);
};