forked from ak-fortuna/fortuna
fortuna: std::atomic<bool> continue_running
This commit is contained in:
parent
e706de7702
commit
2c56d9af27
14
fortuna.h
14
fortuna.h
|
@ -8,8 +8,10 @@
|
|||
#include <fmt/core.h>
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <exception>
|
||||
#include <latch>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
@ -84,6 +86,17 @@ public:
|
|||
|
||||
auto urandom_entropy_src_service() -> void;
|
||||
|
||||
auto stop_running() -> int {
|
||||
try {
|
||||
fmt::print("[i] fortuna: received the stop request...\n");
|
||||
this->continue_running.store(false);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
throw;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PRNG state
|
||||
class R_state {
|
||||
friend fortuna::Fortuna;
|
||||
|
@ -118,6 +131,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::atomic<bool> continue_running{true};
|
||||
std::once_flag PRNG_init;
|
||||
|
||||
}; // class Fortuna
|
||||
|
|
Loading…
Reference in New Issue