From 7803c5e1e589d00f32151084fbc4c251d63864eb Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Fri, 9 Jul 2021 00:45:55 -0700 Subject: [PATCH] :racehorse: static thread_local negatively effects BankResponse --- src/bank.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bank.cpp b/src/bank.cpp index 3ab46fb..0adbea5 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -100,11 +100,11 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam return {k404NotFound, "\"Reciever does not exist\""}; } - static thread_local BankResponse state; + BankResponse state; std::shared_lock lock{save_lock}; //about 10% of this function's cost #if MAX_LOG_SIZE > 0 static thread_local Transaction temp(a_name, b_name, amount); - if (!users.modify_if(a_name, [amount](User &a) { + if (!users.modify_if(a_name, [&state, amount](User &a) { #else if (!users.modify_if(a_name, [&state, amount](User &a) { #endif