Skip to content
Snippets Groups Projects
Commit 82b7e3be authored by Gabriele Svelto's avatar Gabriele Svelto Committed by Pier Angelo Vendrame
Browse files

Bug 1670885 - Replace deprecated NSSpinLocks with os_unfair_locks in the...

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
parent 69da4acc
No related branches found
No related tags found
1 merge request!735Bug 42033: Rebased release onto 102.15.0esr (last 102.x release!)
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment