summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/coroutines/coroutines.c
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-21 10:49:45 +0200
committertylov <[email protected]>2023-07-21 10:49:45 +0200
commitdbcc13635402bd466675f4f41e865d02abc6f918 (patch)
tree269bbb8e641aaad34b0cca0bbd23c854faa3a960 /misc/examples/coroutines/coroutines.c
parent2d67f4040f6eecd41f1b864b43c62823ed75aff0 (diff)
downloadSTC-modified-dbcc13635402bd466675f4f41e865d02abc6f918.tar.gz
STC-modified-dbcc13635402bd466675f4f41e865d02abc6f918.zip
NB! Changed some coroutine API for consistency/simplicity: Added full task support.
Diffstat (limited to 'misc/examples/coroutines/coroutines.c')
-rw-r--r--misc/examples/coroutines/coroutines.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/examples/coroutines/coroutines.c b/misc/examples/coroutines/coroutines.c
index de0fcda5..489c3ed6 100644
--- a/misc/examples/coroutines/coroutines.c
+++ b/misc/examples/coroutines/coroutines.c
@@ -84,13 +84,13 @@ struct combined {
int combined(struct combined* g) {
cco_routine(g) {
- cco_await_on(prime(&g->prm));
- cco_await_on(fibonacci(&g->fib));
+ cco_call_await(prime(&g->prm));
+ cco_call_await(fibonacci(&g->fib));
// Reuse the g->prm context and extend the count:
g->prm.count = 8, g->prm.result += 2;
cco_reset(&g->prm);
- cco_await_on(prime(&g->prm));
+ cco_call_await(prime(&g->prm));
cco_cleanup:
puts("final combined");
@@ -103,7 +103,7 @@ int main(void)
struct combined c = {.prm={.count=8}, .fib={14}};
int res;
- cco_block_on(combined(&c), &res) {
+ cco_call_blocking(combined(&c), &res) {
if (res == CCO_YIELD)
printf("Prime(%d)=%lld, Fib(%d)=%lld\n",
c.prm.idx, c.prm.result,