From f4af9f4fbc0041502dde74320aed505127bfbdff Mon Sep 17 00:00:00 2001 From: Yongrong Wang Date: Tue, 8 Oct 2024 14:33:44 +0800 Subject: [PATCH] lib/cpu.h: create a new libmetal API metal_yield metal_yield would be managed at the OS level and dispatched to metal_cpu_yield, metal_sleep_usec, or others, it is more flexible to manage this in libmetal Signed-off-by: Yongrong Wang --- lib/cpu.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cpu.h b/lib/cpu.h index 3ee3596b..b30d1f84 100644 --- a/lib/cpu.h +++ b/lib/cpu.h @@ -18,6 +18,13 @@ # include #else # include +# include +#endif + +#if defined(HAVE_PROCESSOR_CPU_H) +#define metal_yield() metal_cpu_yield() +#else +#define metal_yield() metal_sleep_usec(1000) #endif #endif /* __METAL_CPU__H__ */