From b909bee0e400fa12908bc3d9bca447ea2a71864b Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 8 May 2023 11:14:03 +0200 Subject: More coroutine updates. --- misc/examples/coroutines.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'misc/examples') diff --git a/misc/examples/coroutines.c b/misc/examples/coroutines.c index 9071fee0..7f255dda 100644 --- a/misc/examples/coroutines.c +++ b/misc/examples/coroutines.c @@ -81,26 +81,26 @@ struct combined { }; -bool combined(struct combined* g) { +void combined(struct combined* g) { cco_begin(g); - cco_await(prime(&g->prm), false); - cco_await(fibonacci(&g->fib), false); + cco_await(prime(&g->prm)); + cco_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(prime(&g->prm), false); + cco_await(prime(&g->prm)); cco_final: puts("final combined"); - cco_end(true); + cco_end(); } int main(void) { struct combined c = {.prm={.count=8}, .fib={14}}; - while (!combined(&c)) { + cco_run_blocked(&c, combined(&c)) { printf("Prime(%d)=%lld, Fib(%d)=%lld\n", c.prm.idx, c.prm.result, c.fib.idx, c.fib.result); -- cgit v1.2.3