aboutsummaryrefslogtreecommitdiff
path: root/include/apos
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-10-21 17:43:31 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-10-21 17:43:31 +0300
commitec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6 (patch)
tree51221980ad2d4c8701e1a6e762a47495dec289de /include/apos
parenta06dbb8a63d825ebb1ad65372ce1ce1f572891bc (diff)
downloadkmi-ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6.tar.gz
kmi-ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6.zip
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?
Diffstat (limited to 'include/apos')
-rw-r--r--include/apos/utils.h11
1 files changed, 11 insertions, 0 deletions
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
@@ -187,6 +187,17 @@
#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.
*
* @param ptr Pointer to member in some structure.