Commits
Marcus Calhoun-Lopez authored 4adad9cbfe6
1 + | --- src/ptex/PtexPlatform.h.orig 2018-04-10 15:47:40.000000000 -0700 |
2 + | +++ src/ptex/PtexPlatform.h 2018-11-02 09:28:24.000000000 -0700 |
3 + | |
4 + | #include <pthread.h> |
5 + | |
6 + | #ifdef __APPLE__ |
7 + | -#include <os/lock.h> |
8 + | +#include <libkern/OSAtomic.h> |
9 + | #include <sys/types.h> |
10 + | #endif |
11 + | #endif |
12 + | |
13 + | #ifdef __APPLE__ |
14 + | class SpinLock { |
15 + | public: |
16 + | - SpinLock() { _spinlock = OS_UNFAIR_LOCK_INIT; } |
17 + | + SpinLock() { _spinlock = 0; } |
18 + | ~SpinLock() { } |
19 + | - void lock() { os_unfair_lock_lock(&_spinlock); } |
20 + | - bool trylock() { return os_unfair_lock_trylock(&_spinlock); } |
21 + | - void unlock() { os_unfair_lock_unlock(&_spinlock); } |
22 + | + void lock() { OSSpinLockLock(&_spinlock); } |
23 + | + bool trylock() { return OSSpinLockTry(&_spinlock); } |
24 + | + void unlock() { OSSpinLockUnlock(&_spinlock); } |
25 + | private: |
26 + | - os_unfair_lock _spinlock; |
27 + | + OSSpinLock _spinlock; |
28 + | }; |
29 + | #else |
30 + | class SpinLock { |