summaryrefslogtreecommitdiff
path: root/libcr/include
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-09 08:32:53 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-09 12:24:43 -0700
commitf6ef0cb3f5cf5a1605f9f154cfff05acb67a738d (patch)
tree81e6a1ec714366e9696144e0101020c15ef1b7b7 /libcr/include
parentf869eaedbb73694816c4bfba87184e7849486675 (diff)
libcr: Add public cr_assert_in_{coroutine,intrhandler}()
Diffstat (limited to 'libcr/include')
-rw-r--r--libcr/include/libcr/coroutine.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/libcr/include/libcr/coroutine.h b/libcr/include/libcr/coroutine.h
index f6c5e14..eb5828b 100644
--- a/libcr/include/libcr/coroutine.h
+++ b/libcr/include/libcr/coroutine.h
@@ -164,6 +164,27 @@ bool cr_is_in_intrhandler(void);
*/
void cr_unpause_from_intrhandler(cid_t);
+/**
+ * cr_assert_in_coroutine() asserts that it is being called from a
+ * running coroutine.
+ */
+#ifdef NDEBUG
+#define cr_assert_in_coroutine() ((void)0)
+#else
+void cr_assert_in_coroutine(void);
+#endif
+
+
+/**
+ * cr_assert_in_intrhandler() asserts that it is being called from an
+ * interrupt handler.
+ */
+#ifdef NDEBUG
+#define cr_assert_in_intrhandler() ((void)0)
+#else
+void cr_assert_in_intrhandler(void);
+#endif
+
/* answering questions about coroutines ***************************************/
/* While the following are defined here unconditionally, the