解决OSSpinLock has been deprecated问题,使用os_unfair_lock取代 #include <os/lock.h> void foo() { os_unfair_lock lock = OS_UNFAIR_LOCK_INIT; os_unfair_lock_lock(&lock); /* Your critical section here */ os_unfair_lock_unlock(&lock); } 1234567891011 #include <os/lock.h> void foo() { os_unfair_lock lock = OS_UNFAIR_LOCK_INIT; os_unfair_lock_lock(&lock); /* Your critical section here */ os_unfair_lock_unlock(&lock);}