Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Struct fcontext_t and related functions

struct stack_t
{
    void    *   base;
    void    *   limit;
};

struct fcontext_t
{
    < platform specific >

    stack_t  fc_stack;
};

intptr_t jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp);
void make_fcontext( fcontext_t * fc, void(* fn)(intptr_t) );
base

Member:

Pointer to the top of the stack.

limit

Member:

Pointer to the bottom of the stack.

fc_stack

Member:

Tracks the memory for the context's stack.

intptr_t jump_fcontext( fcontext_t * ofc, fcontext_t * nfc, intptr_t p, bool preserve_fpu)

Effects:

Stores the current context data (stack pointer, instruction pointer, and CPU registers) to *ofc and restores the context data from *nfc, which implies jumping to *nfc's execution context. The intptr_t argument, p, is passed to the current context to be returned by the most recent call to jump_fcontext() in the same thread. The last argument controls if fpu registers have to be preserved.

Returns:

The third pointer argument passed to the most recent call to jump_fcontext(), if any.

void make_fcontext( fcontext_t * fc, void(*fn)(intptr_t))

Precondition:

A stack is applied to *fc before make_fcontext() is called.

Effects:

Modifies *fc in order to execute fn when the context is activated next.


PrevUpHomeNext