Coroutines in C. More...
Go to the source code of this file.
Macros | |
| #define | CORO_CONTEXT(name) co_t co_##name |
| Define the coroutine context (a pointer to label). More... | |
| #define | CORO_CONTEXT_INIT(name) |
| #define | CORO_LOCAL static |
| Declare the local variable that preserves a value across a coroutine switching. | |
| #define | CORO_DEFINE(name) int coro_##name( co_t *co_p ) |
| Define the coroutine. More... | |
| #define | CORO_BEGIN(initial) |
| The coroutine beginning. More... | |
| #define | CORO_END(final) |
| The coroutine end. More... | |
| #define | CORO_YIELD(final) |
| Switching to the next coroutine. More... | |
| #define | CORO_WAIT(cond, ...) |
| Waiting for the condition is true. More... | |
| #define | CORO_RESTART(final) |
| Restart the coroutine. More... | |
| #define | CORO_QUIT(final) CORO_END( final ) |
| Quit the coroutine. More... | |
| #define | CORO_CALL(name) coro_##name( &co_##name ) |
| Call the coroutine. More... | |
| #define | CORO_ALIVE(coro) (( coro ) < CO_END ) |
| Checking the coroutine is not completed. More... | |
| #define | CORO_WAIT_CORO(coro, ...) CORO_WAIT( !CORO_ALIVE( coro ), ## __VA_ARGS__ ) |
| Start and waiting for the child coroutine is completed. More... | |
| #define | SEMAPHORE_INIT(name, val) |
| Initialize the semaphore. More... | |
| #define | SEMAPHORE_ACQUIRE(name, ...) |
| Waiting and acquire the semaphore. More... | |
| #define | SEMAPHORE_RELEASE(name) |
| Release the semaphore. More... | |
Typedefs | |
| typedef void * | co_t |
| typedef unsigned int | semaphore_t |
Enumerations | |
| enum | { CO_READY, CO_WAIT, CO_YIELD, CO_END, CO_SKIP } |
Coroutines in C.
1.8.11