fortuna: move whole ctor code into a try block
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c852c723fd
commit
b24cf7566a
15
fortuna.cpp
15
fortuna.cpp
|
@ -27,19 +27,20 @@ auto now{std::chrono::steady_clock::now()};
|
||||||
Fortuna::Fortuna() {
|
Fortuna::Fortuna() {
|
||||||
try {
|
try {
|
||||||
initialize_prng();
|
initialize_prng();
|
||||||
|
|
||||||
this->sync_point.wait(); // wait for init
|
this->sync_point.wait(); // wait for init
|
||||||
|
|
||||||
|
th_gen = std::thread(&Fortuna::generator_service,
|
||||||
|
this,
|
||||||
|
std::make_shared<fortuna::generator::Generator>());
|
||||||
|
th_accu = std::thread(&Fortuna::accumulator_service, this);
|
||||||
|
th_sfm = std::thread(&Fortuna::seed_file_manager_service, this);
|
||||||
|
th_urandom = std::thread(&Fortuna::urandom_entropy_src_service, this);
|
||||||
}
|
}
|
||||||
catch (CryptoPP::Exception& e) {
|
catch (CryptoPP::Exception& e) {
|
||||||
fmt::print(stderr, "{}\n", e.what());
|
fmt::print(stderr, "{}\n", e.what());
|
||||||
// perhaps die on error
|
// perhaps die on error
|
||||||
}
|
}
|
||||||
|
|
||||||
th_gen = std::thread(&Fortuna::generator_service,
|
|
||||||
this,
|
|
||||||
std::make_shared<fortuna::generator::Generator>());
|
|
||||||
th_accu = std::thread(&Fortuna::accumulator_service, this);
|
|
||||||
th_sfm = std::thread(&Fortuna::seed_file_manager_service, this);
|
|
||||||
th_urandom = std::thread(&Fortuna::urandom_entropy_src_service, this);
|
|
||||||
}
|
}
|
||||||
Fortuna::~Fortuna() noexcept {
|
Fortuna::~Fortuna() noexcept {
|
||||||
if (th_gen.joinable()) {
|
if (th_gen.joinable()) {
|
||||||
|
|
Reference in New Issue