For macCatalyst, which designed to be used on macOS 10.13, so don't need OSSpinLock
This commit is contained in:
parent
cbbf3285e8
commit
d406215cc9
|
@ -12,24 +12,40 @@
|
|||
#import "SDmetamacros.h"
|
||||
|
||||
#ifndef SD_LOCK_DECLARE
|
||||
#if TARGET_OS_MACCATALYST
|
||||
#define SD_LOCK_DECLARE(lock) os_unfair_lock lock;
|
||||
#else
|
||||
#define SD_LOCK_DECLARE(lock) os_unfair_lock lock API_AVAILABLE(ios(10.0), tvos(10), watchos(3), macos(10.12)); \
|
||||
OSSpinLock lock##_deprecated;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SD_LOCK_INIT
|
||||
#if TARGET_OS_MACCATALYST
|
||||
#define SD_LOCK_INIT(lock) lock = OS_UNFAIR_LOCK_INIT;
|
||||
#else
|
||||
#define SD_LOCK_INIT(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) lock = OS_UNFAIR_LOCK_INIT; \
|
||||
else lock##_deprecated = OS_SPINLOCK_INIT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SD_LOCK
|
||||
#if TARGET_OS_MACCATALYST
|
||||
#define SD_LOCK(lock) os_unfair_lock_lock(&lock);
|
||||
#else
|
||||
#define SD_LOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_lock(&lock); \
|
||||
else OSSpinLockLock(&lock##_deprecated);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SD_UNLOCK
|
||||
#if TARGET_OS_MACCATALYST
|
||||
#define SD_UNLOCK(lock) os_unfair_lock_unlock(&lock);
|
||||
#else
|
||||
#define SD_UNLOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_unlock(&lock); \
|
||||
else OSSpinLockUnlock(&lock##_deprecated);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SD_OPTIONS_CONTAINS
|
||||
#define SD_OPTIONS_CONTAINS(options, value) (((options) & (value)) == (value))
|
||||
|
|
Loading…
Reference in New Issue