summaryrefslogtreecommitdiffhomepage
path: root/docs/coroutine_api.md
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-08-17 04:37:22 +0200
committerTyge Lovset <[email protected]>2023-08-17 04:37:22 +0200
commit2ba238e66efec7b6d895425c4f1160b3b72d242b (patch)
treed7c4a8946b92a9eea8aee296e0a58f71a292816b /docs/coroutine_api.md
parent3da201d122a47f7bf6381b23702815474d64c471 (diff)
downloadSTC-modified-2ba238e66efec7b6d895425c4f1160b3b72d242b.tar.gz
STC-modified-2ba238e66efec7b6d895425c4f1160b3b72d242b.zip
Small refactoring.
Diffstat (limited to 'docs/coroutine_api.md')
-rw-r--r--docs/coroutine_api.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/coroutine_api.md b/docs/coroutine_api.md
index c44f4a4d..b917e0a1 100644
--- a/docs/coroutine_api.md
+++ b/docs/coroutine_api.md
@@ -231,25 +231,25 @@ void print_time()
// PRODUCER
cco_task_struct (produce_items,
struct next_value next;
- cstr str;
+ cstr text;
);
int produce_items(struct produce_items* p, cco_runtime* rt)
{
cco_routine (p) {
- p->str = cstr_init();
+ p->text = cstr_init();
p->next.cco_func = next_value;
while (true)
{
// await for CCO_YIELD (or CCO_DONE)
cco_await_task(&p->next, rt, CCO_YIELD);
- cstr_printf(&p->str, "item %d", p->next.val);
+ cstr_printf(&p->text, "item %d", p->next.val);
print_time();
- printf("produced %s\n", cstr_str(&p->str));
+ printf("produced %s\n", cstr_str(&p->text));
cco_yield();
}
cco_final:
- cstr_drop(&p->str);
+ cstr_drop(&p->text);
puts("done produce");
}
return 0;
@@ -271,7 +271,7 @@ int consume_items(struct consume_items* c, cco_runtime* rt)
printf("consume #%d\n", c->i);
cco_await_task(&c->produce, rt, CCO_YIELD);
print_time();
- printf("consumed %s\n", cstr_str(&c->produce.str));
+ printf("consumed %s\n", cstr_str(&c->produce.text));
}
cco_final:
cco_stop(&c->produce);