aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Zeitlin <vadim@zeitlins.org>2016-11-15 16:44:45 +0100
committerVadim Zeitlin <vadim@zeitlins.org>2016-11-15 16:44:45 +0100
commitbd9a9ace4ae6da3e6600a58f79b1acb51edc831b (patch)
tree892819ad1a55b0cc981eb48d528497e995cfb586
parent4e39b23e455e455f1878b3e68d729a1737f3e431 (diff)
downloadcrow-bd9a9ace4ae6da3e6600a58f79b1acb51edc831b.tar.gz
crow-bd9a9ace4ae6da3e6600a58f79b1acb51edc831b.zip
Use atomic type for connection count shared between threads
Even if this variable is only used in debug mode, it's still bad to have data races on it, as it was the case (and reported by thread sanitizer) before.
-rw-r--r--include/crow/http_connection.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/crow/http_connection.h b/include/crow/http_connection.h
index 96f2d14..7e0a9f3 100644
--- a/include/crow/http_connection.h
+++ b/include/crow/http_connection.h
@@ -176,7 +176,7 @@ namespace crow
}
#ifdef CROW_ENABLE_DEBUG
- static int connectionCount;
+ static std::atomic<int> connectionCount;
#endif
template <typename Adaptor, typename Handler, typename ... Middlewares>
class Connection