From 3e62fa9b6fbc656f86f7394f4e1ba5789c5a0547 Mon Sep 17 00:00:00 2001 From: Leonardo Carreras Date: Mon, 3 Feb 2025 16:43:42 +0000 Subject: [PATCH] Adapt the queue test to be architecture-agnostic Signed-off-by: Leonardo Carreras --- tests/unit/queue.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/unit/queue.cpp b/tests/unit/queue.cpp index c3f213fba..77e0505d5 100644 --- a/tests/unit/queue.cpp +++ b/tests/unit/queue.cpp @@ -62,8 +62,14 @@ uint64_t thread_get_id() { return -1; } -// Sleep, do nothing -__attribute__((always_inline)) static inline void nop() { __asm__("rep nop;"); } +// Sleep, do nothing (Architecture-Specific) +__attribute__((always_inline)) static inline void nop() { +#if defined(__aarch64__) + __asm__ volatile("yield"); /// ARM equivalent of rep nop. +#else + __asm__ volatile("rep nop"); /// x86 and most other architectures use rep nop. +#endif +} static void *producer(void *ctx) { int ret;