fixed race condition at startup

This commit is contained in:
orignal 2016-04-02 08:57:35 -04:00
parent 1fc5dacd87
commit 0bf2abaa4c

View File

@ -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;
} }