fortuna: add seed_file_manager_service() [wip]

This commit is contained in:
surtur 2022-01-04 06:44:30 +01:00
parent cc26b654d4
commit 06db22bfa4
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 17 additions and 0 deletions

View File

@ -20,9 +20,11 @@ namespace fortuna {
fmt::print(stderr, "{}\n", e.what());
}
th_gen = std::thread(generator_service, &R.Gen);
th_sfm = std::thread(seed_file_manager_service);
}
Fortuna::~Fortuna() noexcept {
th_gen.join();
th_sfm.join();
}
@ -93,6 +95,20 @@ namespace fortuna {
}
}
auto Fortuna::seed_file_manager_service() -> void {
// TODO(me): implement proper logic, i.e. include SeedFileManager
fmt::print("[i] fortuna: starting seed file manager service\n");
// FIXME: proper interval is 10 minutes
uint interval{1}; // in seconds
auto now{fortuna::Util::current_time()};
while(true) {
now = fortuna::Util::current_time();
fmt::print("[*] sfm: hello now @{}\n", now);
std::this_thread::sleep_until(now + std::chrono::seconds(interval));
}
}
} // namespace fortuna
#endif//FORTUNA_FORTUNA_CPP

View File

@ -19,6 +19,7 @@ public:
static constexpr const char num_of_pools{32};
std::mutex mtx;
std::thread th_gen;
std::thread th_sfm;
Fortuna();
~Fortuna() noexcept;