Simple coroutine library / objects in plain C Snapshot
|
#include <ucontext.h>
#include <stdint.h>
#include <corothread/stacks.h>
#include <corothread/val.h>
Go to the source code of this file.
Classes | |
struct | tagCTHREAD |
Typedefs | |
typedef void(* | CTHREAD_PROC )(VALUES *) |
typedef struct tagCTHREAD | CTHREAD |
Enumerations | |
enum | CTHREAD_STATE { CTHREAD_STATE_INIT, CTHREAD_STATE_RUNNING, CTHREAD_STATE_SUSPENDED, CTHREAD_STATE_EXIT } |
Functions | |
int | CTHREAD_libinit () |
library initialisation | |
CTHREAD * | CTHREAD_init (STACKS *stacks, CTHREAD_PROC proc) |
initialises a new co-routine thread. | |
int | CTHREAD_free (CTHREAD *thread) |
int | CTHREAD_start (CTHREAD *thread, VALUES **rvalue, const char *format,...) |
start a new thread - the thread procedure is invoked. | |
int | CTHREAD_resume (CTHREAD *thread, VALUES **rvalue, const char *format,...) |
resume a suspended thread | |
int | CTHREAD_yield (VALUES **rvalue, const char *format,...) |
a running thread temporarily suspends execution | |
int | CTHREAD_join (CTHREAD *thread, VALUES **rvalue) |
waits till the thread has finished Calls CTHREAD_resume repeatedly unntil the thread finishes. | |
int | CTHREAD_set_return_value (const char *format,...) |
a running thread sets it return values | |
uint32_t | CTHREAD_get_tid () |
get thread id | |
M_INLINE CTHREAD_STATE | CTHREAD_state (CTHREAD *thread) |
get thread state |