#include <libkern/OSSpinLockDeprecated.h>
libkern/OSSpinLockDeprecated.h
@header
These are deprecated legacy interfaces for userspace spinlocks.
These interfaces should no longer be used, particularily in situations where
threads of differing priorities may contend on the same spinlock.
The interfaces in <os/lock.h> should be used instead in cases where a very
low-level lock primitive is required. In general however, using higher level
synchronization primitives such as those provided by the pthread or dispatch
subsystems should be preferred.
Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of these
interfaces in terms of the <os/lock.h> primitives. This is intended as a
transition convenience, direct use of those primitives is preferred.
macroOSSPINLOCK_DEPRECATED
#define OSSPINLOCK_DEPRECATED 1
macroOSSPINLOCK_DEPRECATED_MSG
#define OSSPINLOCK_DEPRECATED_MSG(_r) "Use " #_r "() from <os/lock.h> instead"
macroOSSPINLOCK_DEPRECATED_REPLACE_WITH
#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSSPINLOCK_DEPRECATED_MSG(_r)) __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSSPINLOCK_DEPRECATED_MSG(_r))
macroOS_SPINLOCK_INIT
@abstract The default value for an <code>OSSpinLock</code>.
@discussion The convention is that unlocked is zero, locked is nonzero.
#define OS_SPINLOCK_INIT 0
typedefOSSpinLock
@abstract Data type for a spinlock.
@discussion You should always initialize a spinlock to {@link OS_SPINLOCK_INIT} before
using it.
typedef int32_t OSSpinLock
functionOSSpinLockTry
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSSpinLockTry( volatile OSSpinLock *__lock )
deprecated
@abstract Locks a spinlock if it would not block
@result Returns <code>false</code> if the lock was already held by another thread,
<code>true</code> if it took the lock successfully.
man page · May 26, 2004
OSSpinLockTry(3) — deprecated atomic spin lock synchronization primitivesfunctionOSSpinLockLock
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) void OSSpinLockLock( volatile OSSpinLock *__lock )
deprecated
@abstract Locks a spinlock
@discussion Although the lock operation spins, it employs various strategies to back
off if the lock is held.
man page · May 26, 2004
OSSpinLockLock(3) — deprecated atomic spin lock synchronization primitivesfunctionOSSpinLockUnlock
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) void OSSpinLockUnlock( volatile OSSpinLock *__lock )
deprecated
@abstract Unlocks a spinlock
man page · May 26, 2004
OSSpinLockUnlock(3) — deprecated atomic spin lock synchronization primitives