Local continuations form the basis for implementing protothreads. More...
Files | |
file | lc-addrlabels.h |
Implementation of local continuations based on the "Labels as values" feature of gcc. | |
file | lc-switch.h |
Implementation of local continuations based on switch() statement. | |
Defines | |
#define | LC_INIT(lc) |
Initialize a local continuation. | |
#define | LC_SET(lc) |
Set a local continuation. | |
#define | LC_RESUME(lc) |
Resume a local continuation. | |
#define | LC_END(lc) |
Mark the end of local continuation usage. | |
Typedefs | |
typedef void * | lc_t |
The local continuation type. |
Local continuations form the basis for implementing protothreads.
A local continuation can be set in a specific function to capture the state of the function. After a local continuation has been set can be resumed in order to restore the state of the function at the point where the local continuation was set.
#define LC_END | ( | lc | ) |
#define LC_INIT | ( | lc | ) |
#define LC_RESUME | ( | lc | ) |
Resume a local continuation.
The resume operation resumes a previously set local continuation, thus restoring the state in which the function was when the local continuation was set. If the local continuation has not been previously set, the resume operation does nothing.
#define LC_SET | ( | lc | ) |
Set a local continuation.
The set operation saves the state of the function at the point where the operation is executed. As far as the set operation is concerned, the state of the function does not include the call-stack or local (automatic) variables, but only the program counter and such CPU registers that needs to be saved.