diff --git a/src/stan/callbacks/concurrent_writer.hpp b/src/stan/callbacks/concurrent_writer.hpp index 959ba222510..faee38abaa6 100644 --- a/src/stan/callbacks/concurrent_writer.hpp +++ b/src/stan/callbacks/concurrent_writer.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,7 @@ struct concurrent_writer { // Threshold where the writing threads will wait for the queues to empty std::size_t wait_threshold{max_capacity - max_threads - 1}; // Flag to stop the writing thread once all queues are empty - bool continue_writing_{true}; + std::atomic continue_writing_{true}; /** * Constructs a concurrent writer from a writer.