aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-01-22 01:11:16 +0100
committerShauren <shauren.trinity@gmail.com>2022-01-22 01:25:28 +0100
commitcd5fdc50efb4eee10d18881f6683d460a45937c9 (patch)
tree19d8bff478041fee64bd5ce49d8a4f4df91d39b0 /src
parenta03e26aa81ec20d7187c81e99d4c1e585b67f0e3 (diff)
Core/DBLayer: Fixed false positive msvc analysis warning
(cherry picked from commit 6ce56e8137133f003fa42277d10c3ad03b8996e2)
Diffstat (limited to 'src')
-rw-r--r--src/server/database/Database/Transaction.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/server/database/Database/Transaction.cpp b/src/server/database/Database/Transaction.cpp
index 609ae0b9588..4f4767ece92 100644
--- a/src/server/database/Database/Transaction.cpp
+++ b/src/server/database/Database/Transaction.cpp
@@ -77,9 +77,13 @@ bool TransactionTask::Execute()
if (errorCode == ER_LOCK_DEADLOCK)
{
- std::ostringstream threadIdStream;
- threadIdStream << std::this_thread::get_id();
- std::string threadId = threadIdStream.str();
+ std::string threadId = []()
+ {
+ // wrapped in lambda to fix false positive analysis warning C26115
+ std::ostringstream threadIdStream;
+ threadIdStream << std::this_thread::get_id();
+ return threadIdStream.str();
+ }();
// Make sure only 1 async thread retries a transaction so they don't keep dead-locking each other
std::lock_guard<std::mutex> lock(_deadlockLock);
@@ -122,9 +126,13 @@ bool TransactionWithResultTask::Execute()
if (errorCode == ER_LOCK_DEADLOCK)
{
- std::ostringstream threadIdStream;
- threadIdStream << std::this_thread::get_id();
- std::string threadId = threadIdStream.str();
+ std::string threadId = []()
+ {
+ // wrapped in lambda to fix false positive analysis warning C26115
+ std::ostringstream threadIdStream;
+ threadIdStream << std::this_thread::get_id();
+ return threadIdStream.str();
+ }();
// Make sure only 1 async thread retries a transaction so they don't keep dead-locking each other
std::lock_guard<std::mutex> lock(_deadlockLock);