From bd9a9ace4ae6da3e6600a58f79b1acb51edc831b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 15 Nov 2016 16:44:45 +0100 Subject: [PATCH] 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. --- include/crow/http_connection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crow/http_connection.h b/include/crow/http_connection.h index 96f2d1458..7e0a9f367 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 connectionCount; #endif template class Connection