From 94391527ef50cbee073a4b427f6fe839c010ecb1 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Tue, 1 Aug 2023 16:47:38 +0200 Subject: 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() --- misc/examples/coroutines/coroutines.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'misc/examples/coroutines/coroutines.c') 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, -- cgit v1.2.3