fortuna: use die_point latch
All checks were successful
continuous-integration/drone/push Build is passing

wait on the latch in Fortuna's dtor until threads finish execution
This commit is contained in:
surtur 2022-01-23 20:11:11 +01:00
parent 680272bed4
commit fa4c9d048e
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -39,6 +39,7 @@ Fortuna::Fortuna() {
}
}
Fortuna::~Fortuna() noexcept {
this->die_point.wait();
fmt::print("[*] Fortuna says goodbye!\n");
}
@ -159,6 +160,10 @@ auto Fortuna::seed_file_manager_service() -> void {
std::this_thread::sleep_until(right_now +
std::chrono::seconds(checkup_interval));
}
std::lock_guard<std::mutex> p_ul(print_mtx);
fmt::print("[*] sfm: stopping, goodbye!\n\n");
this->die_point.count_down();
}
auto Fortuna::urandom_entropy_src_service() -> void {
@ -210,6 +215,10 @@ auto Fortuna::urandom_entropy_src_service() -> void {
}
mtx_l.unlock();
}
std::lock_guard<std::mutex> p_ul(print_mtx);
fmt::print("[*] ues: stopping, goodbye!\n\n");
this->die_point.count_down();
}
} // namespace fortuna