Skip to content

Commit

Permalink
lib/cpu.h: create a new libmetal API metal_yield
Browse files Browse the repository at this point in the history
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 <wangyongrong@xiaomi.com>
  • Loading branch information
wyr-7 committed Oct 8, 2024
1 parent a4bce35 commit f4af9f4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
# include <metal/processor/@PROJECT_PROCESSOR@/cpu.h>
#else
# include <metal/processor/generic/cpu.h>
# include <metal/sleep.h>
#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__ */

0 comments on commit f4af9f4

Please sign in to comment.