diff --git a/fortuna.cpp b/fortuna.cpp index 4455b60..624b848 100644 --- a/fortuna.cpp +++ b/fortuna.cpp @@ -30,10 +30,6 @@ Fortuna::Fortuna() { this->sync_point.wait(); // wait for init - th_gen = std::thread(&Fortuna::generator_service, - this, - std::make_shared()); - 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); } @@ -43,12 +39,6 @@ Fortuna::Fortuna() { } } Fortuna::~Fortuna() noexcept { - if (th_gen.joinable()) { - th_gen.join(); - } - if (th_accu.joinable()) { - th_accu.join(); - } if (th_sfm.joinable()) { th_sfm.join(); } @@ -124,47 +114,6 @@ auto Fortuna::random_data(unsigned int n_bytes) -> void { fmt::print("getting random data took {:.{}f}s\n", diff.count(), 12); } // random_data -auto Fortuna::generator_service( - std::shared_ptr Gen) -> void { - static constexpr const std::chrono::milliseconds sleep_time{1000}; - - std::chrono::system_clock::time_point time_point; - - { - std::lock_guard p_ul(print_mtx); - fmt::print("[i] fortuna: starting generator service\n"); - } - - while (true) { - time_point = fortuna::Util::current_time(); - { - std::lock_guard p_ul(print_mtx); - fmt::print("[*] g: @{}\n", time_point); - } - std::this_thread::sleep_until(time_point + - std::chrono::milliseconds(sleep_time)); - } -} - -auto Fortuna::accumulator_service() -> void { - static constexpr const std::chrono::seconds sleep_time{10}; - - std::chrono::system_clock::time_point time_point; - { - std::lock_guard p_ul(print_mtx); - fmt::print("[i] fortuna: starting accumulator service\n"); - } - - while (true) { - time_point = fortuna::Util::current_time(); - { - std::lock_guard p_ul(print_mtx); - fmt::print("[*] accu: @{}\n", time_point); - } - std::this_thread::sleep_until(time_point + - std::chrono::seconds(sleep_time)); - } -} auto Fortuna::seed_file_manager_service() -> void { static constexpr const std::chrono::seconds checkup_interval{10}; diff --git a/fortuna.h b/fortuna.h index 676dad9..6c07dc8 100644 --- a/fortuna.h +++ b/fortuna.h @@ -24,8 +24,6 @@ public: std::mutex mtx_p_pools; mutable std::mutex mtx_accu; // used in const fun, too std::mutex print_mtx; - std::thread th_gen; - std::thread th_accu; std::thread th_sfm; std::thread th_urandom; std::latch sync_point{1}; // wait for init before spawning the threads @@ -80,11 +78,6 @@ public: fmt::print("[*] fortuna: PRNG initialized\n"); } - auto generator_service(std::shared_ptr Gen) - -> void; - - auto accumulator_service() -> void; - auto seed_file_manager_service() -> void; auto urandom_entropy_src_service() -> void;