nit: std::call_once
would be appropriate here I think, but the current approach is clear too so not important
0diff --git a/src/kernel/context.cpp b/src/kernel/context.cpp
1index a7c3457c8c..c34dc84704 100644
2--- a/src/kernel/context.cpp
3+++ b/src/kernel/context.cpp
4@@ -8,19 +8,18 @@
5 #include <logging.h>
6 #include <random.h>
7
8+#include <mutex>
9 #include <string>
10
11 namespace kernel {
12 Context::Context()
13 {
14- static bool initialized{false};
15- if (!initialized) {
16+ static std::once_flag is_initialized;
17+ std::call_once(is_initialized, [](){
18 std::string sha256_algo = SHA256AutoDetect();
19 LogInfo("Using the '%s' SHA256 implementation\n", sha256_algo);
20 RandomInit();
21- }
22- initialized = true;
23+ });
24 }
25
26-
27 } // namespace kernel