Merge pull request #26354 from ksooo/pvr-fix-listitem-titleextrainfo
[xbmc.git] / lib / libUPnP / patches / 0052-libUPnP-Remove-deprecated-volatile-usage.patch
blobfc7b2bc56edc116ee94d28583f92c63388b93058
1 From 26b0002d2c181ca4e4b4ca5b253540b428273291 Mon Sep 17 00:00:00 2001
2 From: Philipp Kerling <yol@casix.org>
3 Date: Sat, 11 May 2024 00:44:57 +0200
4 Subject: [PATCH 3/8] libUPnP: Remove deprecated volatile usage
6 With the atomic_int, the mutex is no longer necessary as well.
7 ---
8 .../Neptune/Source/System/Posix/NptPosixThreads.cpp | 13 ++-----------
9 1 file changed, 2 insertions(+), 11 deletions(-)
11 diff --git a/lib/libUPnP/Neptune/Source/System/Posix/NptPosixThreads.cpp b/lib/libUPnP/Neptune/Source/System/Posix/NptPosixThreads.cpp
12 index 510d3e9fbd..47ccd48241 100644
13 --- a/lib/libUPnP/Neptune/Source/System/Posix/NptPosixThreads.cpp
14 +++ b/lib/libUPnP/Neptune/Source/System/Posix/NptPosixThreads.cpp
15 @@ -13,6 +13,7 @@
16 #if defined(__SYMBIAN32__)
17 #include <stdio.h>
18 #endif
19 +#include <atomic>
20 #include <pthread.h>
21 #include <unistd.h>
22 #include <time.h>
23 @@ -278,8 +279,7 @@ class NPT_PosixAtomicVariable : public NPT_AtomicVariableInterface
25 private:
26 // members
27 - volatile int m_Value;
28 - pthread_mutex_t m_Mutex;
29 + std::atomic_int m_Value;
32 /*----------------------------------------------------------------------
33 @@ -288,7 +288,6 @@ class NPT_PosixAtomicVariable : public NPT_AtomicVariableInterface
34 NPT_PosixAtomicVariable::NPT_PosixAtomicVariable(int value) :
35 m_Value(value)
37 - pthread_mutex_init(&m_Mutex, NULL);
40 /*----------------------------------------------------------------------
41 @@ -296,7 +295,6 @@ NPT_PosixAtomicVariable::NPT_PosixAtomicVariable(int value) :
42 +---------------------------------------------------------------------*/
43 NPT_PosixAtomicVariable::~NPT_PosixAtomicVariable()
45 - pthread_mutex_destroy(&m_Mutex);
48 /*----------------------------------------------------------------------
49 @@ -307,9 +305,7 @@ NPT_PosixAtomicVariable::Increment()
51 int value;
53 - pthread_mutex_lock(&m_Mutex);
54 value = ++m_Value;
55 - pthread_mutex_unlock(&m_Mutex);
57 return value;
59 @@ -322,9 +318,7 @@ NPT_PosixAtomicVariable::Decrement()
61 int value;
63 - pthread_mutex_lock(&m_Mutex);
64 value = --m_Value;
65 - pthread_mutex_unlock(&m_Mutex);
67 return value;
69 @@ -335,7 +329,6 @@ NPT_PosixAtomicVariable::Decrement()
70 int
71 NPT_PosixAtomicVariable::GetValue()
73 - // we assume that int read/write are atomic on the platform
74 return m_Value;
77 @@ -345,9 +338,7 @@ NPT_PosixAtomicVariable::GetValue()
78 void
79 NPT_PosixAtomicVariable::SetValue(int value)
81 - pthread_mutex_lock(&m_Mutex);
82 m_Value = value;
83 - pthread_mutex_unlock(&m_Mutex);
86 /*----------------------------------------------------------------------
87 --
88 2.44.0