summaryrefslogtreecommitdiff
path: root/libcr_ipc/include
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-16 05:21:31 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-16 09:02:38 -0600
commita5061fa634af1e7011182e1c115151dd96af8393 (patch)
treee13794366a09d0480253076d458b413faa5680a5 /libcr_ipc/include
parentcf102e5e0ce3dfcba0a2dbb6c3d16883e0525b41 (diff)
lib9p_srv: Re-think flush semantics
Diffstat (limited to 'libcr_ipc/include')
-rw-r--r--libcr_ipc/include/libcr_ipc/chan.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libcr_ipc/include/libcr_ipc/chan.h b/libcr_ipc/include/libcr_ipc/chan.h
index 79be220..853b4ad 100644
--- a/libcr_ipc/include/libcr_ipc/chan.h
+++ b/libcr_ipc/include/libcr_ipc/chan.h
@@ -97,9 +97,25 @@
(CH)->core.waiters.front->val.op == _CR_SELECT_OP_SEND); \
})
+/**
+ * cr_chan_num_waiters(ch) returns the number of coroutines currently
+ * blocked on the channel.
+ *
+ * @runs_in coroutine
+ * @cr_pauses never
+ * @cr_yields never
+ *
+ * size_t cr_chan_num_waiters(NAME##_t *ch);
+ */
+#define cr_chan_num_waiters(CH) ({ \
+ cr_assert_in_coroutine(); \
+ ((CH)->core.nwaiters); \
+})
+
DLIST_DECLARE(_cr_select_arg_list);
struct _cr_chan {
struct _cr_select_arg_list waiters;
+ size_t nwaiters;
};
/* cr_select arguments ********************************************************/