NinjaFlight
|
Go to the source code of this file.
Data Structures | |
struct | pt |
Macros | |
#define | LC_ADDRLABELS_H_ |
#define | LC_INIT(s) s = NULL |
#define | LC_RESUME(s) |
#define | LC_SET(s) do { ({ __label__ resume; resume: (s) = &&resume; }); }while(0) |
#define | LC_END(s) |
#define | PT_WAITING 0 |
#define | PT_YIELDED 1 |
#define | PT_EXITED 2 |
#define | PT_ENDED 3 |
Initialization | |
#define | PT_INIT(pt) |
Declaration and definition | |
#define | PT_THREAD(name_args) |
#define | PT_BEGIN(pt) |
#define | PT_END(pt) |
Blocked wait | |
#define | PT_WAIT_UNTIL(pt, condition) |
#define | PT_WAIT_WHILE(pt, cond) |
Hierarchical protothreads | |
#define | PT_WAIT_THREAD(pt, thread) |
#define | PT_SPAWN(pt, child, thread) |
Exiting and restarting | |
#define | PT_RESTART(pt) |
#define | PT_EXIT(pt) |
Calling a protothread | |
#define | PT_SCHEDULE(f) |
Yielding from a protothread | |
#define | PT_YIELD(pt) |
#define | PT_YIELD_UNTIL(pt, cond) |
Yield from the protothread until a condition occurs. More... | |
Typedefs | |
typedef void * | lc_t |
Protothreads implementation.
Implementation of local continuations based on the "Labels as values" feature of gcc
This implementation of local continuations is based on a special feature of the GCC C compiler called "labels as values". This feature allows assigning pointers with the address of the code corresponding to a particular C label.
For more information, see the GCC documentation: http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
Thanks to dividuum for finding the nice local scope label implementation.