File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Framework/Foundation/3rdparty/x9 Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 3535#include "x9.h"
3636
3737#include <assert.h> /* assert */
38+ #if defined(__x86_64__ ) || defined(__i386__ )
3839#include <immintrin.h> /* _mm_pause */
40+ #elif defined(__aarch64__ )
41+ #else
42+ #error Not supported architecture
43+ #endif
3944#include <stdarg.h> /* va_* */
4045#include <stdatomic.h> /* atomic_* */
4146#include <stdbool.h> /* bool */
@@ -361,7 +366,13 @@ void x9_read_from_inbox_spin(x9_inbox* const inbox,
361366 register x9_msg_header * const header = x9_header_ptr (inbox , idx );
362367
363368 for (;;) {
369+ #if defined(__x86_64__ ) || defined(__i386__ )
364370 _mm_pause ();
371+ #elif defined(__aarch64__ )
372+ __asm__ __volatile__ ("yield" );
373+ #else
374+ #error Not supported architecture
375+ #endif
365376 if (atomic_load_explicit (& header -> slot_has_data , __ATOMIC_RELAXED )) {
366377 if (atomic_load_explicit (& header -> msg_written , __ATOMIC_ACQUIRE )) {
367378 memcpy (outparam , (char * )header + sizeof (x9_msg_header ), msg_sz );
You can’t perform that action at this time.
0 commit comments