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.
This commit is contained in:
Vadim Zeitlin 2016-11-15 16:44:45 +01:00
parent 4e39b23e45
commit bd9a9ace4a

View File

@ -176,7 +176,7 @@ namespace crow
} }
#ifdef CROW_ENABLE_DEBUG #ifdef CROW_ENABLE_DEBUG
static int connectionCount; static std::atomic<int> connectionCount;
#endif #endif
template <typename Adaptor, typename Handler, typename ... Middlewares> template <typename Adaptor, typename Handler, typename ... Middlewares>
class Connection class Connection