diff options
| author | Tyge Løvset <[email protected]> | 2023-08-01 16:47:38 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-08-01 18:09:40 +0200 |
| commit | 94391527ef50cbee073a4b427f6fe839c010ecb1 (patch) | |
| tree | f4d48b7efd6a11d94d08c4ef2ee599601b949dbb /misc/examples/coroutines/filetask.c | |
| parent | 6354a597892e84baa6c3a99b98f2c7acaf33a99d (diff) | |
| download | STC-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/filetask.c')
| -rw-r--r-- | misc/examples/coroutines/filetask.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/misc/examples/coroutines/filetask.c b/misc/examples/coroutines/filetask.c index bfce7810..28292801 100644 --- a/misc/examples/coroutines/filetask.c +++ b/misc/examples/coroutines/filetask.c @@ -21,7 +21,7 @@ int file_read(struct file_read* co, cco_runtime* rt) while (true) { // emulate async io: await 10ms per line - cco_timer_await(&co->tm, 0.003); + cco_await_timer(&co->tm, 0.003); if (!cstr_getline(&co->line, co->fp)) break; @@ -50,7 +50,7 @@ int count_line(struct count_line* co, cco_runtime* rt) while (true) { // await for next CCO_YIELD (or CCO_DONE) in file_read() - cco_task_await(&co->reader, rt, CCO_YIELD); + cco_await_task(&co->reader, rt, CCO_YIELD); if (rt->result == CCO_DONE) break; co->lineCount += 1; cco_yield(); @@ -73,7 +73,7 @@ int main(void) // Execute coroutine as top-level blocking int loop = 0; - cco_task_blocking(&countTask) { ++loop; } + cco_blocking_task(&countTask) { ++loop; } printf("line count = %d\n", countTask.lineCount); printf("exec count = %d\n", loop); |
