ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
Last change
on this file since fa66f4e was 78b3f52, checked in by Thierry Delisle <tdelisle@…>, 9 years ago |
Ugly but working coroutines
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[78b3f52] | 1 |
|
---|
| 2 | #ifndef _INVOKE_H_
|
---|
| 3 | #define _INVOKE_H_
|
---|
| 4 |
|
---|
| 5 | struct coVtable {
|
---|
| 6 | void (*main)(void*);
|
---|
| 7 | struct coroutine* (*this_coroutine)(void*);
|
---|
| 8 | };
|
---|
| 9 |
|
---|
| 10 | struct coStack_t {
|
---|
| 11 | unsigned int size; // size of stack
|
---|
| 12 | void *storage; // pointer to stack
|
---|
| 13 | void *limit; // stack grows towards stack limit
|
---|
| 14 | void *base; // base of stack
|
---|
| 15 | void *context; // address of cfa_context_t
|
---|
| 16 | void *top; // address of top of storage
|
---|
| 17 | bool userStack;
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | enum coroutine_state { Start, Inactive, Active, Halt };
|
---|
| 22 |
|
---|
| 23 | struct coroutine {
|
---|
| 24 | struct coStack_t stack;
|
---|
| 25 | const char *name; // textual name for coroutine/task, initialized by uC++ generated code
|
---|
| 26 | int errno_; // copy of global UNIX variable errno
|
---|
| 27 | enum coroutine_state state; // current execution status for coroutine
|
---|
| 28 | bool notHalted; // indicate if execuation state is not halted
|
---|
| 29 |
|
---|
| 30 | struct coroutine *starter; // first coroutine to resume this one
|
---|
| 31 | struct coroutine *last; // last coroutine to resume this one
|
---|
| 32 | };
|
---|
| 33 |
|
---|
| 34 | #endif //_INVOKE_H_
|
---|
Note:
See
TracBrowser
for help on using the repository browser.