summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/coroutines/coroutines.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-08-01 16:47:38 +0200
committerTyge Løvset <[email protected]>2023-08-01 18:09:40 +0200
commit94391527ef50cbee073a4b427f6fe839c010ecb1 (patch)
treef4d48b7efd6a11d94d08c4ef2ee599601b949dbb /misc/examples/coroutines/coroutines.c
parent6354a597892e84baa6c3a99b98f2c7acaf33a99d (diff)
downloadSTC-modified-94391527ef50cbee073a4b427f6fe839c010ecb1.tar.gz
STC-modified-94391527ef50cbee073a4b427f6fe839c010ecb1.zip
Last minute API change for coroutines before V4.3 release:
- Renamed cco_xxxx_await() => cco_await_xxxx() (call, task, sem, timer) - Renamed cco_xxxx_blocking() => cco_blocking_xxxx() (call, task) - Renamed cco_task_resume() => cco_resume_task() - Simplified cco_blocking_call()
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 489c3ed6..faeb71f6 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_call_await(prime(&g->prm));
- cco_call_await(fibonacci(&g->fib));
+ cco_await_call(prime(&g->prm));
+ cco_await_call(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_call_await(prime(&g->prm));
+ cco_await_call(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_call_blocking(combined(&c), &res) {
+ cco_blocking_call(res = combined(&c)) {
if (res == CCO_YIELD)
printf("Prime(%d)=%lld, Fib(%d)=%lld\n",
c.prm.idx, c.prm.result,