Local continuations
[Protothreads]


Detailed Description

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.


Files

file  lc.h
 Local continuations.
file  lc-switch.h
 Implementation of local continuations based on switch() statment.
file  lc-addrlabels.h
 Implementation of local continuations based on the "Labels as values" feature of gcc.

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.
#define LC_INIT(s)   s = 0;
#define LC_RESUME(s)   switch(s) { case 0:
#define LC_SET(s)   s = __LINE__; case __LINE__:
#define LC_END(s)   }
#define LC_INIT(s)   s = NULL
#define LC_RESUME(s)
#define LC_CONCAT2(s1, s2)   s1##s2
#define LC_CONCAT(s1, s2)   LC_CONCAT2(s1, s2)
#define LC_SET(s)
#define LC_END(s)

Typedefs

typedef unsigned short lc_t
 The local continuation type.
typedef void * lc_t


Define Documentation

#define LC_END lc   ) 
 

Mark the end of local continuation usage.

The end operation signifies that local continuations should not be used any more in the function. This operation is not needed for most implementations of local continuation, but is required by a few implementations.

Definition at line 108 of file lc.h.

#define LC_INIT lc   ) 
 

Initialize a local continuation.

This operation initializes the local continuation, thereby unsetting any previously set continuation state.

Definition at line 71 of file lc.h.

#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.

Definition at line 96 of file lc.h.

#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.

Definition at line 84 of file lc.h.


Generated on Mon Oct 2 10:06:29 2006 for The Protothreads Library 1.4 by  doxygen 1.4.6