lc-switch.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define __LC_SWTICH_H__
#define LC_END(s)   }
#define LC_INIT(s)   s = 0;
#define LC_RESUME(s)   switch(s) { case 0:
#define LC_SET(s)   s = __LINE__; case __LINE__:


typedef unsigned short lc_t

Detailed Description

Implementation of local continuations based on switch() statment
Adam Dunkels <>
This implementation of local continuations uses the C switch() statement to resume execution of a function somewhere inside the function's body. The implementation is based on the fact that switch() statements are able to jump directly into the bodies of control structures such as if() or while() statmenets.

This implementation borrows heavily from Simon Tatham's coroutines implementation in C:

Definition in file lc-switch.h.

Generated on Wed Jun 3 12:05:50 2009 for PowWow v1.0 by  doxygen 1.5.6