summaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-06-14 13:24:29 +0200
committerTyge Løvset <[email protected]>2023-06-14 13:24:29 +0200
commit3f919a3b38a88e1c96399cd6096dec16060802a1 (patch)
tree8c071e33522d31cd7c90834423760da514fc7f46 /misc
parentc51bdc8d8aeac63c0af955f81593ef0be326a7e0 (diff)
downloadSTC-modified-3f919a3b38a88e1c96399cd6096dec16060802a1.tar.gz
STC-modified-3f919a3b38a88e1c96399cd6096dec16060802a1.zip
Fixed a bug in cco_await_on(), and added _pull() function to random access containers (moves element out of container, ie no drop).
Diffstat (limited to 'misc')
-rw-r--r--misc/examples/scheduler.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/misc/examples/scheduler.c b/misc/examples/scheduler.c
index aecb1a26..54fefc47 100644
--- a/misc/examples/scheduler.c
+++ b/misc/examples/scheduler.c
@@ -2,12 +2,9 @@
#include <stdio.h>
#include <stc/calgo.h>
-struct Scheduler;
-struct Task {
- bool (*resume)(struct Task*);
+cco_closure(bool, Task,
struct Scheduler* sched;
- int cco_state;
-};
+);
#define i_type Scheduler
#define i_val struct Task
@@ -20,7 +17,7 @@ static bool schedule(Scheduler* sched)
Scheduler_pop(sched);
if (!cco_done(&task))
- task.resume(&task);
+ cco_resume(&task);
return !Scheduler_empty(sched);
}