2 .Dt SPINLOCK_DEPRECATED 3
8 .Nd deprecated atomic spin lock synchronization primitives
10 .In libkern/OSAtomic.h
12 .Fn OSSpinLockTry "OSSpinLock *lock"
14 .Fn OSSpinLockLock "OSSpinLock *lock"
16 .Fn OSSpinLockUnlock "OSSpinLock *lock"
19 These are deprecated interfaces for userspace spinlocks, provided for
20 compatibility with legacy code. These interfaces should no longer be used,
21 particularily in situations where threads of differing priorities may contend
26 should be used instead in cases where a very low-level lock primitive is
27 required. In general however, using higher level synchronization primitives
28 such as those provided by the pthread or dispatch subsystems are preferred.
31 The OSSpinLock operations use memory barriers to synchronize access to shared
32 memory protected by the lock. Preemption is possible while the lock is held.
35 is an integer type. The convention is that unlocked is zero, and locked is nonzero.
36 Locks must be naturally aligned and cannot be in cache-inhibited memory.
39 will spin if the lock is already held, but employs various strategies to back
40 off. Because it can spin, it will generally be less cpu and power efficient than
41 other synchronization primitives.
44 immediately returns false if the lock was held, true if it took the lock.
48 unconditionally unlocks the lock by zeroing it.
51 returns true if it took the lock, false if the lock was already held.
54 .Xr atomic_deprecated 3