mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 15:09:31 +03:00
Implement ARM/Aarch64 atomic_yield fastpath
This commit is contained in:
parent
06f8da4218
commit
77991fccee
1 changed files with 8 additions and 1 deletions
|
@ -156,10 +156,17 @@ static inline uintptr_t mi_atomic_exchange(volatile uintptr_t* p, uintptr_t exch
|
||||||
static inline void mi_atomic_yield() {
|
static inline void mi_atomic_yield() {
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
|
#elif (defined(__GNUC__) || defined(__clang__)) && \
|
||||||
|
(defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__))
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
static inline void mi_atomic_yield() {
|
static inline void mi_atomic_yield() {
|
||||||
asm volatile ("pause" ::: "memory");
|
asm volatile ("pause" ::: "memory");
|
||||||
}
|
}
|
||||||
|
#elif defined(__arm__) || defined(__aarch64__)
|
||||||
|
static inline void mi_atomic_yield() {
|
||||||
|
asm volatile("yield");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
static inline void mi_atomic_yield() {
|
static inline void mi_atomic_yield() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue