mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 13:43:15 +00:00
Merge pull request #87393 from stuartcarnie/bugfix
Use `os_unfair_lock` on Apple platforms
This commit is contained in:
commit
c1dbaa73a6
@ -33,6 +33,25 @@
|
||||
|
||||
#include "core/typedefs.h"
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include <os/lock.h>
|
||||
|
||||
class SpinLock {
|
||||
mutable os_unfair_lock _lock = OS_UNFAIR_LOCK_INIT;
|
||||
|
||||
public:
|
||||
_ALWAYS_INLINE_ void lock() const {
|
||||
os_unfair_lock_lock(&_lock);
|
||||
}
|
||||
|
||||
_ALWAYS_INLINE_ void unlock() const {
|
||||
os_unfair_lock_unlock(&_lock);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#include <atomic>
|
||||
|
||||
class SpinLock {
|
||||
@ -49,4 +68,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
#endif // SPIN_LOCK_H
|
||||
|
Loading…
Reference in New Issue
Block a user