WISP ERT (Client)  1.0.0
The WISP Extended Runtime (WISP side)
ucontext.h File Reference
#include <stdint.h>
#include <signal.h>

Go to the source code of this file.

Data Structures

struct  mcontext_t
 ERT machine context type. More...
 
struct  ucontext_t
 ERT user context type. More...
 

Macros

#define getcontext(ctx)   (getmcontext(&(ctx)->uc_mcontext))
 Get user context marco. More...
 
#define setcontext(ctx)   (setmcontext(&(ctx)->uc_mcontext))
 Set user context marco. More...
 

Functions

int getmcontext (mcontext_t *ctx)
 Get machine context. More...
 
int setmcontext (const mcontext_t *ctx)
 Set machine context. More...
 
void makecontext (ucontext_t *ctx, void(*func)(), int argc,...)
 Make user context. More...
 
int swapcontext (ucontext_t *octx, const ucontext_t *ctx)
 Swap user context. More...
 

Macro Definition Documentation

◆ getcontext

#define getcontext (   ctx)    (getmcontext(&(ctx)->uc_mcontext))

Get user context marco.

◆ setcontext

#define setcontext (   ctx)    (setmcontext(&(ctx)->uc_mcontext))

Set user context marco.

Function Documentation

◆ getmcontext()

int getmcontext ( mcontext_t ctx)

Get machine context.

Parameters
ctxMachine context.
Returns
0 when context is saved, 1 when context is restored.

◆ makecontext()

void makecontext ( ucontext_t ctx,
void(*)()  func,
int  argc,
  ... 
)

Make user context.

(TODO: Make context issues)

Parameters
ctxUser context.
funcFunction to run.
argcNumber of arguments.

◆ setmcontext()

int setmcontext ( const mcontext_t ctx)

Set machine context.

Parameters
ctxMachine context.
Returns
This function does not actually return.

◆ swapcontext()

int swapcontext ( ucontext_t octx,
const ucontext_t ctx 
)

Swap user context.

Parameters
octxOld user context to save.
ctxUser context to restore.