From b8a2822dc87f61a967be607f0b7592029a4b9e99 Mon Sep 17 00:00:00 2001 From: Maxim Sharabayko Date: Thu, 8 Aug 2024 10:33:29 +0200 Subject: [PATCH] [core] Made CSndQueue::m_counter atomic. --- srtcore/queue.cpp | 2 +- srtcore/queue.h | 2 +- srtcore/sync.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srtcore/queue.cpp b/srtcore/queue.cpp index 7adc9aa47..d5127faaf 100644 --- a/srtcore/queue.cpp +++ b/srtcore/queue.cpp @@ -444,7 +444,7 @@ int srt::CSndQueue::sockoptQuery(int level, int type) const } #if ENABLE_LOGGING -int srt::CSndQueue::m_counter = 0; +srt::sync::atomic srt::CSndQueue::m_counter(0); #endif void srt::CSndQueue::init(CChannel* c, CTimer* t) diff --git a/srtcore/queue.h b/srtcore/queue.h index 43219736f..132b670b3 100644 --- a/srtcore/queue.h +++ b/srtcore/queue.h @@ -469,7 +469,7 @@ class CSndQueue private: #if ENABLE_LOGGING - static int m_counter; + static srt::sync::atomic m_counter; #endif CSndQueue(const CSndQueue&); diff --git a/srtcore/sync.h b/srtcore/sync.h index e8b7444bd..9d282304c 100644 --- a/srtcore/sync.h +++ b/srtcore/sync.h @@ -540,7 +540,7 @@ class SRT_ATTR_SCOPED_CAPABILITY ExclusiveLock m_mutex.lock(); } - SRT_ATTR_RELEASE() + SRT_ATTR_RELEASE(m_mutex) ~ExclusiveLock() { m_mutex.unlock(); } private: