summaryrefslogtreecommitdiff
path: root/libcr/coroutine.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-13 15:23:42 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-19 20:15:12 -0700
commit0360ef3a038c8c3f6f252fdc8f1b91e4cbdd4e39 (patch)
tree387fde8b794f059484e300bef5fc1051fb30095c /libcr/coroutine.c
parent363e741feba2268db9c72215460c627bcc4f33ac (diff)
libcr: Start to add coroutine names
Diffstat (limited to 'libcr/coroutine.c')
-rw-r--r--libcr/coroutine.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index 49146f1..205d0bb 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -405,7 +405,9 @@ static inline void assert_cid(cid_t cid) {
/* coroutine_add() ************************************************************/
-cid_t coroutine_add_with_stack_size(size_t stack_size, cr_fn_t fn, void *args) {
+cid_t coroutine_add_with_stack_size(size_t stack_size,
+ const char __attribute__((unused)) *name,
+ cr_fn_t fn, void *args) {
static cid_t last_created = 0;
cid_t parent = coroutine_running;
@@ -413,8 +415,8 @@ cid_t coroutine_add_with_stack_size(size_t stack_size, cr_fn_t fn, void *args) {
assert_cid_state(parent, state == CR_RUNNING);
assert(stack_size);
assert(fn);
- debugf("coroutine_add_with_stack_size(%zu, %p, %p)...\n",
- stack_size, fn, args);
+ debugf("coroutine_add_with_stack_size(%zu, \"%s\", %p, %p)...\n",
+ stack_size, name, fn, args);
cid_t child;
{
@@ -470,9 +472,9 @@ cid_t coroutine_add_with_stack_size(size_t stack_size, cr_fn_t fn, void *args) {
return child;
}
-cid_t coroutine_add(cr_fn_t fn, void *args) {
+cid_t coroutine_add(const char *name, cr_fn_t fn, void *args) {
return coroutine_add_with_stack_size(
- CONFIG_COROUTINE_DEFAULT_STACK_SIZE, fn, args);
+ CONFIG_COROUTINE_DEFAULT_STACK_SIZE, name, fn, args);
}
/* coroutine_main() ***********************************************************/