From dcabb07707f9b6071001cccd29d7cd1c46537424 Mon Sep 17 00:00:00 2001 From: Zwelf Date: Sun, 9 Jan 2022 16:22:07 +0100 Subject: [PATCH] Fix uninitialized count variable and naming convention --- src/base/tl/threading.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/base/tl/threading.h b/src/base/tl/threading.h index 275b28d29..7c3b3cc5e 100644 --- a/src/base/tl/threading.h +++ b/src/base/tl/threading.h @@ -9,21 +9,21 @@ class CSemaphore SEMAPHORE m_Sem; // implement the counter seperatly, because the `sem_getvalue`-API is // deprecated on macOS: https://stackoverflow.com/a/16655541 - std::atomic_int count; + std::atomic_int m_Count{0}; public: CSemaphore() { sphore_init(&m_Sem); } ~CSemaphore() { sphore_destroy(&m_Sem); } CSemaphore(const CSemaphore &) = delete; - int GetApproximateValue() { return count.load(); } + int GetApproximateValue() { return m_Count.load(); } void Wait() { sphore_wait(&m_Sem); - count.fetch_sub(1); + m_Count.fetch_sub(1); } void Signal() { - count.fetch_add(1); + m_Count.fetch_add(1); sphore_signal(&m_Sem); } };