diff --git a/fortuna.cpp b/fortuna.cpp index 62751f9..1d3e351 100644 --- a/fortuna.cpp +++ b/fortuna.cpp @@ -55,6 +55,8 @@ Fortuna::~Fortuna() noexcept { auto Fortuna::random_data(unsigned int n_bytes) -> void { + std::lock_guard lg(mtx_random_data); + const auto start{std::chrono::system_clock::now()}; fmt::print("random_data starting - {}\n", start); auto elapsed{std::chrono::duration_cast( diff --git a/fortuna.h b/fortuna.h index acd5b41..6a62dc3 100644 --- a/fortuna.h +++ b/fortuna.h @@ -19,6 +19,7 @@ class Fortuna { public: static constexpr const char NUM_OF_POOLS{32}; std::mutex mtx; + std::mutex mtx_random_data; std::mutex accu_mtx; std::mutex print_mtx; std::thread th_gen;