Implement ARM/Aarch64 atomic_yield fastpath

This commit is contained in:
Jim Huang 2019-06-23 16:53:00 +08:00 committed by Jim Huang
parent 06f8da4218
commit 77991fccee

View file

@ -156,10 +156,17 @@ static inline uintptr_t mi_atomic_exchange(volatile uintptr_t* p, uintptr_t exch
static inline void mi_atomic_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() {
asm volatile ("pause" ::: "memory");
}
#elif defined(__arm__) || defined(__aarch64__)
static inline void mi_atomic_yield() {
asm volatile("yield");
}
#endif
#else
#include <unistd.h>
static inline void mi_atomic_yield() {