From ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 21 Oct 2022 17:43:31 +0300 Subject: initial implementation of swap + Slightly unsure if it should be a syscall, or if assign would be enough. Also, which thread should run in a fork/spawn? For now, old thread, though this might increase latency. Or add swap flag to these calls? --- include/apos/utils.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/apos') diff --git a/include/apos/utils.h b/include/apos/utils.h index 29969c4..6eeb54f 100644 --- a/include/apos/utils.h +++ b/include/apos/utils.h @@ -186,6 +186,17 @@ #define unlikely(x) (x) #endif +/** + * Signal to the compiler that some region is unreachable. + * Mainly used for debugging with instrumentation, though it could provide some + * micro-optimisations. +*/ +#if __has_builtin(__builtin_unreachable) +#define unreachable() __builtin_unreachable() +#else +#define unreachable() +#endif + /** * Get container of some member. * -- cgit v1.3