From f6ef0cb3f5cf5a1605f9f154cfff05acb67a738d Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 9 Dec 2024 08:32:53 -0700 Subject: libcr: Add public cr_assert_in_{coroutine,intrhandler}() --- libcr/include/libcr/coroutine.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libcr/include') 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 -- cgit v1.2.3-2-g168b