summaryrefslogtreecommitdiffhomepage
path: root/docs
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 /docs
parentbca31bb8d85d6781f0c3d074eb1a25fa6de48e07 (diff)
downloadSTC-modified-b909bee0e400fa12908bc3d9bca447ea2a71864b.tar.gz
STC-modified-b909bee0e400fa12908bc3d9bca447ea2a71864b.zip
More coroutine updates.
Diffstat (limited to 'docs')
-rw-r--r--docs/ccommon_api.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md
index c20043f8..daf21e56 100644
--- a/docs/ccommon_api.md
+++ b/docs/ccommon_api.md
@@ -314,7 +314,7 @@ bool triples(struct triples* i) { // coroutine
}
}
}
- cco_final: // required for cleanup
+ cco_final: // tear down
puts("done");
cco_end(true);
}
@@ -363,6 +363,8 @@ To resume the coroutine from where it was suspended with *cco_yield()*, simply c
| | `cco_yield(retval)` | Suspend execution and return retval |
| | `cco_await(promise)` | Suspend until promise is true |
| | `cco_await(promise, retval)` | Suspend with retval until promise is true |
+| | `cco_call(ctx, corocall)` | Call coro async, suspend while not done |
+| | `cco_call(ctx, corocall, retval)` | Call coro async, return retval on suspend |
| | Semaphores: | |
| | `csem` | Semaphore type |
| | `cco_await_sem(sem)` | Await for the semaphore count > 0 |
@@ -373,13 +375,14 @@ To resume the coroutine from where it was suspended with *cco_yield()*, simply c
| | `ctimer` | Timer type |
| | `cco_await_timer(tm)` | Await for timer to expire |
| | `cco_await_timer(tm, retval)` | Await with retval for timer to expire |
-| | `ctimer_start(tm, long msecs)` | Start timer for milliseconds |
+| | `ctimer_start(tm, long msecs)` | Start timer msecs milliseconds |
| | `ctimer_restart(tm)` | Restart timer with same duration |
| `bool` | `ctimer_expired(tm)` | Return true if timer is expired |
| `long` | `ctimer_remaining(tm)` | Return milliseconds remaining |
| | From caller side: | |
| `void` | `cco_stop(ctx)` | Next call of coroutine returns `cco_end()` |
| `void` | `cco_reset(ctx)` | Reset state to initial (for reuse) |
+| `void` | `cco_run_blocked(ctx, corocall) { }` | Call coro blocked until done |
---
## RAII scope macros