summaryrefslogtreecommitdiff
path: root/coroutine.h
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-18 00:53:51 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-18 00:53:51 -0600
commit52eb34af7be585c411a9a9ab39f0bea1d19e7d32 (patch)
tree27218b9838f6b76b138ae27ae1ed05ad0b8382ad /coroutine.h
parent8e5d84d3724afd9278ac759213d7ea6eb0982e54 (diff)
fix?
Diffstat (limited to 'coroutine.h')
-rw-r--r--coroutine.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/coroutine.h b/coroutine.h
index 273680d..fbaf000 100644
--- a/coroutine.h
+++ b/coroutine.h
@@ -13,6 +13,8 @@
/* typedefs *******************************************************************/
typedef size_t cid_t; /* 0=none; otherwise 1-indexed */
+
+#define COROUTINE __attribute__ ((noreturn, no_split_stack)) void
typedef void (*cr_fn_t)(void *args);
/* managing coroutines ********************************************************/
@@ -23,12 +25,12 @@ void coroutine_main(void);
/* inside of coroutines *******************************************************/
-bool cr_begin(void);
-void cr_exit(void);
-void cr_yield(void);
-void cr_pause_and_yield(void);
-void cr_unpause(cid_t);
-#define cr_end()
+__attribute__ ((no_split_stack)) bool cr_begin( void);
+__attribute__ ((no_split_stack, noreturn)) void cr_exit(void);
+__attribute__ ((no_split_stack)) void cr_yield(void);
+__attribute__ ((no_split_stack)) void cr_pause_and_yield(void);
+__attribute__ ((no_split_stack)) void cr_unpause(cid_t);
+#define cr_end cr_exit
cid_t cr_getcid(void);