fortuna: use a once_flag in initialize_prng()

This commit is contained in:
surtur 2022-01-23 20:37:15 +01:00
parent 01de51dc73
commit e706de7702
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -51,6 +51,8 @@ public:
auto initialize_prng() -> void {
try {
std::call_once(PRNG_init, [] { ; });
set_reseed_ctr_to_null();
std::scoped_lock sl(mtx_accu, mtx_p_pools);
@ -116,6 +118,7 @@ public:
std::latch sync_point{1}; // wait for init before spawning the threads
std::latch die_point{2}; // wait for service threads to die
std::once_flag PRNG_init;
}; // class Fortuna