IoTivity-Lite
Local continuations

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.
 
file  lc.h
 Local continuations.
 

Macros

#define LC_END(s)
 
#define LC_END(s)   }
 
#define LC_H_
 
#define LC_INIT(s)   s = NULL
 
#define LC_INIT(s)   s = 0;
 
#define LC_RESUME(s)
 
#define LC_RESUME(s)
 
#define LC_SET(s)
 
#define LC_SET(s)
 

Typedefs

typedef void * lc_t
 
typedef unsigned short lc_t
 

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.

Macro Definition Documentation

◆ LC_RESUME [1/2]

#define LC_RESUME (   s)
Value:
do { \
if (s != NULL) { \
goto *s; \
} \
} while (0)

◆ LC_RESUME [2/2]

#define LC_RESUME (   s)
Value:
switch (s) { /*NOLINT(bugprone-switch-missing-default-case)*/ \
case 0:

◆ LC_SET [1/2]

#define LC_SET (   s)
Value:
do { \
({ \
__label__ resume; \
resume: \
(s) = &&resume; \
}); \
} while (0)

◆ LC_SET [2/2]

#define LC_SET (   s)
Value:
s = __LINE__; \
/* fall through */ \
case __LINE__: