summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/ccommon_api.md7
-rw-r--r--include/stc/algo/coroutine.h5
2 files changed, 7 insertions, 5 deletions
diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md
index 407ddac4..f4a2c349 100644
--- a/docs/ccommon_api.md
+++ b/docs/ccommon_api.md
@@ -362,14 +362,15 @@ To resume the coroutine from where it was suspended with *cco_yield()*, simply c
| | `cco_yield(retval)` | Suspend execution and return retval |
| | `cco_yield()` | Suspend execution (return void) |
| | `cco_await(promise)` | Suspend and return false until promise is true |
+| | `cco_await_void(promise)` | Suspend until promise is true (return void) |
| | `cco_await_while(cond, retval)` | Suspend and return retval while cond is true |
-| | From caller side: | |
-| `void` | `cco_stop(ctx)` | Next call of coroutine returns `cco_end()` |
-| `void` | `cco_reset(ctx)` | Reset state to initial (for reuse) |
| | Semaphores: | |
| | `cco_semaphore` | Semaphore type |
| | `cco_await_sem(sem)` | Await for the semaphore count > 0 |
| | `cco_signal_sem(sem)` | Signal the semaphore by increasing count|
+| | From caller side: | |
+| `void` | `cco_stop(ctx)` | Next call of coroutine returns `cco_end()` |
+| `void` | `cco_reset(ctx)` | Reset state to initial (for reuse) |
---
## RAII scope macros
diff --git a/include/stc/algo/coroutine.h b/include/stc/algo/coroutine.h
index f6769162..5cadbc6a 100644
--- a/include/stc/algo/coroutine.h
+++ b/include/stc/algo/coroutine.h
@@ -89,6 +89,7 @@ enum cco_states {
} while (0)
#define cco_await(promise) cco_await_while(!(promise), false)
+#define cco_await_void(promise) cco_await_while(!(promise), )
#define cco_final \
case cco_state_final: \
@@ -120,7 +121,7 @@ typedef struct {
* This macro carries out the "wait" operation on the semaphore. The
* wait operation causes the "thread" to block while the counter is
* zero. When the counter reaches a value larger than zero, the
- * protothread will continue.
+ * "thread" will continue.
*/
#define cco_await_sem(sem) \
do { \
@@ -136,6 +137,6 @@ typedef struct {
* eventually will cause waiting "threads" to continue executing.
*/
#define cco_signal_sem(sem) ++(sem)->count
-#define cco_reset_sem(sem, value) ((sem)->count = value)
+#define cco_reset_sem(sem, value) ((sem)->count = (value))
#endif