From 760fd1bd9ce4be04313b5e516bcf201fb4e6708e Mon Sep 17 00:00:00 2001 From: surtur Date: Fri, 21 Jan 2022 20:55:44 +0100 Subject: [PATCH] fortuna: std::unique_lock x2 -> std::scoped_lock --- fortuna.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fortuna.h b/fortuna.h index f73eb41..e9bad28 100644 --- a/fortuna.h +++ b/fortuna.h @@ -54,16 +54,14 @@ public: // p. 153 set_reseed_ctr_to_null(); std::unique_lock p_ul(print_mtx); - std::unique_lock a_ul(mtx_accu, std::defer_lock); - std::unique_lock 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