summaryrefslogtreecommitdiffhomepage
path: root/misc/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-05-08 11:14:03 +0200
committerTyge Løvset <[email protected]>2023-05-08 11:14:03 +0200
commitb909bee0e400fa12908bc3d9bca447ea2a71864b (patch)
tree32dfce3fab606e8f163d13fafe3815614537bc1a /misc/examples
parentbca31bb8d85d6781f0c3d074eb1a25fa6de48e07 (diff)
downloadSTC-modified-b909bee0e400fa12908bc3d9bca447ea2a71864b.tar.gz
STC-modified-b909bee0e400fa12908bc3d9bca447ea2a71864b.zip
More coroutine updates.
Diffstat (limited to 'misc/examples')
-rw-r--r--misc/examples/coroutines.c12
1 files changed, 6 insertions, 6 deletions
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);