fixed race condition at startup

pull/468/head
orignal 8 years ago
parent 1fc5dacd87
commit 0bf2abaa4c

@ -435,8 +435,13 @@ namespace crypto
std::unique_ptr<Ed25519>& GetEd25519 () std::unique_ptr<Ed25519>& GetEd25519 ()
{ {
if (!g_Ed25519) if (!g_Ed25519)
g_Ed25519.reset (new Ed25519()); {
auto c = new Ed25519();
if (!g_Ed25519) // make sure it was not created already
g_Ed25519.reset (c);
else
delete c;
}
return g_Ed25519; return g_Ed25519;
} }

Loading…
Cancel
Save