-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full support for latest theos, latest SDK and iOS 10
- Loading branch information
Showing
7 changed files
with
100 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule LightMessaging
updated
1 files
+83 −9 | LightMessaging.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > 100000 | ||
// New SDK | ||
#include <os/lock.h> | ||
#define unfair_lock os_unfair_lock | ||
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000 | ||
// Only targeting new iOS, always use unfair locks | ||
#define unfair_lock_lock os_unfair_lock_lock | ||
#define unfair_lock_trylock os_unfair_lock_trylock | ||
#define unfair_lock_unlock os_unfair_lock_unlock | ||
#else | ||
// Support both at runtime | ||
#import <libkern/OSAtomic.h> | ||
static inline void unfair_lock_lock(unfair_lock *lock) | ||
{ | ||
if (&os_unfair_lock_lock != NULL) { | ||
os_unfair_lock_lock(lock); | ||
} else { | ||
OSSpinLockLock((volatile OSSpinLock *)lock); | ||
} | ||
} | ||
static inline bool unfair_lock_trylock(unfair_lock *lock) | ||
{ | ||
if (&os_unfair_lock_trylock != NULL) { | ||
return os_unfair_lock_trylock(lock); | ||
} else { | ||
return OSSpinLockTry((volatile OSSpinLock *)lock); | ||
} | ||
} | ||
static inline void unfair_lock_unlock(unfair_lock *lock) | ||
{ | ||
if (&os_unfair_lock_unlock != NULL) { | ||
os_unfair_lock_unlock(lock); | ||
} else { | ||
OSSpinLockUnlock((volatile OSSpinLock *)lock); | ||
} | ||
} | ||
#endif | ||
#else | ||
// Old SDK, fallback to using regular old spinlocks | ||
#import <libkern/OSAtomic.h> | ||
#define unfair_lock volatile OSSpinLock | ||
#define unfair_lock_lock OSSpinLockLock | ||
#define unfair_lock_trylock OSSpinLockTry | ||
#define unfair_lock_unlock OSSpinLockUnlock | ||
#endif |