fortuna: std::unique_lock x2 -> std::scoped_lock

This commit is contained in:
surtur 2022-01-21 20:55:44 +01:00
parent 4c77810535
commit 760fd1bd9c
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -54,16 +54,14 @@ public:
// p. 153
set_reseed_ctr_to_null();
std::unique_lock<std::mutex> p_ul(print_mtx);
std::unique_lock<std::mutex> a_ul(mtx_accu, std::defer_lock);
std::unique_lock<std::mutex> pp_ul(mtx_p_pools, std::defer_lock);
std::scoped_lock sl(mtx_accu, mtx_p_pools);
try {
std::lock(a_ul, pp_ul);
R.initialize_pools();
fmt::print("[i] fortuna: pools initialized\n");
p_ul.unlock();
accumulator.set_pools_ptr(R._p_pools);
accumulator.set_gen(R.Gen);
a_ul.unlock();
// FIXME: bogus first reseed here, P_0 definitely hasn't collected
// enough entropy by now