## coroutine

coroutine

## Functions

struct coroutine_stack * | coroutine_stack_init ()
struct coroutine_stack * | coroutine_stack_alloc ()
void | coroutine_stack_release ()
struct coroutine_stack * | coroutine_stack_check ()
void * | coroutine_stack_to_metadata ()
struct coroutine_stack * | coroutine_stack_from_metadata ()
size_t | coroutine_stack_size ()
void | coroutine_init_ ()
#define | coroutine_init()
void | coroutine_switch ()

## Types and Values

struct | coroutine_stack
#define | COROUTINE_STK_OVERHEAD
#define | COROUTINE_MIN_STKSZ
#define | COROUTINE_STACK_MAGIC_BUF
#define | COROUTINE_STACK_MAGIC_ALLOC
#define | COROUTINE_AVAILABLE
struct | coroutine_state

## Description

## Functions

### coroutine_stack_init ()

    struct coroutine_stack *
    coroutine_stack_init (void *buf,
                          size_t bufsize,
                          size_t metasize);

### coroutine_stack_alloc ()

    struct coroutine_stack *
    coroutine_stack_alloc (size_t bufsize,
                           size_t metasize);

### coroutine_stack_release ()

    void
    coroutine_stack_release (struct coroutine_stack *stack,
                             size_t metasize);

### coroutine_stack_check ()

    struct coroutine_stack *
    coroutine_stack_check (struct coroutine_stack *stack,
                           const char *abortstr);

### coroutine_stack_to_metadata ()

    void *
    coroutine_stack_to_metadata (struct coroutine_stack *stack);

### coroutine_stack_from_metadata ()

    struct coroutine_stack *
    coroutine_stack_from_metadata (void *metadata);

### coroutine_stack_size ()

    size_t
    coroutine_stack_size (const struct coroutine_stack *stack);

### coroutine_init_ ()

    void
    coroutine_init_ (struct coroutine_state *cs,
                     void (*fn) (void *),
                     void *arg,
                     struct coroutine_stack *stack);

### coroutine_init()

    #define             coroutine_init(cs, fn, arg, stack)

### coroutine_switch ()

    void
    coroutine_switch (struct coroutine_state *from,
                      const struct coroutine_state *to);

## Types and Values

### struct coroutine_stack

    struct coroutine_stack {
    	uint64_t magic;
    	size_t size;
    	int valgrind_id;
    };

### COROUTINE_STK_OVERHEAD

    #define COROUTINE_STK_OVERHEAD sizeof(struct coroutine_stack)

### COROUTINE_MIN_STKSZ

    #define COROUTINE_MIN_STKSZ		2048

### COROUTINE_STACK_MAGIC_BUF

    #define COROUTINE_STACK_MAGIC_BUF 0xc040c040574cb00f

### COROUTINE_STACK_MAGIC_ALLOC

    #define COROUTINE_STACK_MAGIC_ALLOC 0xc040c040574ca110

### COROUTINE_AVAILABLE

    #define COROUTINE_AVAILABLE		1

### struct coroutine_state

    struct coroutine_state {
    #if HAVE_UCONTEXT
    	ucontext_t uc;
    #endif /* HAVE_UCONTEXT */
    };