From 430368de97bf96d3e7a40db9f8c008c9c694d9c3 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 27 Nov 2015 15:46:30 -0500 Subject: [PATCH] temporary disable Ed25519 per thread --- Signature.cpp | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/Signature.cpp b/Signature.cpp index e60daa9c..de36b64d 100644 --- a/Signature.cpp +++ b/Signature.cpp @@ -421,26 +421,13 @@ namespace crypto EDDSAPoint Bi16Carry; // Bi16[64][0] }; - static std::shared_ptr g_Ed25519; -#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) // gcc 4.8 and higer - static thread_local std::shared_ptr g_Ed25519ThisThread; -#else - static std::shared_ptr g_Ed25519ThisThread; -#endif - std::shared_ptr& GetEd25519 () + static std::unique_ptr g_Ed25519; + std::unique_ptr& GetEd25519 () { - // TODO: implement it better - if (!g_Ed25519ThisThread) - { - if (!g_Ed25519) - { - g_Ed25519 = std::make_shared(); - g_Ed25519ThisThread = g_Ed25519; - } - else - g_Ed25519ThisThread = std::make_shared(*g_Ed25519); - } - return g_Ed25519ThisThread; + if (!g_Ed25519) + g_Ed25519.reset (new Ed25519()); + + return g_Ed25519; }