nit: std::call_once would be appropriate here I think, but the current approach is clear too so not important
<details>
<summary>git diff on 50c14e5a17</summary>
diff --git a/src/kernel/context.cpp b/src/kernel/context.cpp
index a7c3457c8c..c34dc84704 100644
--- a/src/kernel/context.cpp
+++ b/src/kernel/context.cpp
@@ -8,19 +8,18 @@
#include <logging.h>
#include <random.h>
+#include <mutex>
#include <string>
namespace kernel {
Context::Context()
{
- static bool initialized{false};
- if (!initialized) {
+ static std::once_flag is_initialized;
+ std::call_once(is_initialized, [](){
std::string sha256_algo = SHA256AutoDetect();
LogInfo("Using the '%s' SHA256 implementation\n", sha256_algo);
RandomInit();
- }
- initialized = true;
+ });
}
-
} // namespace kernel
</details>