From 40e07e03f23c279dea1f13cacccff8eb79475fd1 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 27 Nov 2025 01:42:24 +0000 Subject: [PATCH] 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. --- src/state.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/state.hpp b/src/state.hpp index 7850659..00aba81 100644 --- a/src/state.hpp +++ b/src/state.hpp @@ -8,6 +8,7 @@ #ifndef STATE_HPP #define STATE_HPP +#include #include #include "base.hpp" @@ -20,6 +21,9 @@ namespace cw::state cw::node::NodeAllocator allocator; std::queue queue; + std::mutex mutex_queue; + std::mutex mutex_allocator; + State(void); };