[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 08/81: Bug 1670885 - Replace deprecated NSSpinLocks with os_unfair_locks in the memory allocator r=glandium



This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-102.4.0esr-12.0-1
in repository tor-browser.

commit 778467900ae5cbc2ca24b365d7b498424e5fd7fc
Author: Gabriele Svelto <gsvelto@xxxxxxxxxxx>
AuthorDate: Tue Jun 7 07:37:20 2022 +0000

    Bug 1670885 - Replace deprecated NSSpinLocks with os_unfair_locks in the memory allocator r=glandium
    
    Depends on D148287
    
    Differential Revision: https://phabricator.services.mozilla.com/D99280
---
 memory/build/Mutex.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/memory/build/Mutex.h b/memory/build/Mutex.h
index 0a1d7631a366..67fd1cc107f6 100644
--- a/memory/build/Mutex.h
+++ b/memory/build/Mutex.h
@@ -10,7 +10,7 @@
 #if defined(XP_WIN)
 #  include <windows.h>
 #elif defined(XP_DARWIN)
-#  include <libkern/OSAtomic.h>
+#  include <os/lock.h>
 #else
 #  include <pthread.h>
 #endif
@@ -24,7 +24,7 @@ struct Mutex {
 #if defined(XP_WIN)
   CRITICAL_SECTION mMutex;
 #elif defined(XP_DARWIN)
-  OSSpinLock mMutex;
+  os_unfair_lock mMutex;
 #else
   pthread_mutex_t mMutex;
 #endif
@@ -36,7 +36,7 @@ struct Mutex {
       return false;
     }
 #elif defined(XP_DARWIN)
-    mMutex = OS_SPINLOCK_INIT;
+    mMutex = OS_UNFAIR_LOCK_INIT;
 #elif defined(XP_LINUX) && !defined(ANDROID)
     pthread_mutexattr_t attr;
     if (pthread_mutexattr_init(&attr) != 0) {
@@ -60,7 +60,7 @@ struct Mutex {
 #if defined(XP_WIN)
     EnterCriticalSection(&mMutex);
 #elif defined(XP_DARWIN)
-    OSSpinLockLock(&mMutex);
+    os_unfair_lock_lock(&mMutex);
 #else
     pthread_mutex_lock(&mMutex);
 #endif
@@ -70,7 +70,7 @@ struct Mutex {
 #if defined(XP_WIN)
     LeaveCriticalSection(&mMutex);
 #elif defined(XP_DARWIN)
-    OSSpinLockUnlock(&mMutex);
+    os_unfair_lock_unlock(&mMutex);
 #else
     pthread_mutex_unlock(&mMutex);
 #endif
@@ -101,7 +101,7 @@ struct StaticMutex {
 typedef Mutex StaticMutex;
 
 #  if defined(XP_DARWIN)
-#    define STATIC_MUTEX_INIT OS_SPINLOCK_INIT
+#    define STATIC_MUTEX_INIT OS_UNFAIR_LOCK_INIT
 #  elif defined(XP_LINUX) && !defined(ANDROID)
 #    define STATIC_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
 #  else

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits