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 to view this page for the latest version.
PrevUpHomeNext

Implementations: fcontext_t, ucontext_t and WinFiber

fcontext_t

The implementation uses fcontext_t per default. fcontext_t is based on assembler and not available for all platforms. It provides a much better performance than ucontext_t (the context switch takes two magnitudes of order less CPU cycles; see section performance) and WinFiber.

[Note] Note

Because the TIB (thread information block on Windows) is not fully described in the MSDN, it might be possible that not all required TIB-parts are swapped. Using WinFiber implementation migh be an alternative.

ucontext_t

As an alternative, ucontext_t can be used by compiling with BOOST_USE_UCONTEXT and b2 property context-impl=ucontext. ucontext_t might be available on a broader range of POSIX-platforms but has some disadvantages (for instance deprecated since POSIX.1-2003, not C99 conform).

[Note] Note

fiber supports Segmented stacks only with ucontext_t as its implementation.

WinFiber

With BOOST_USE_WINFIB and b2 property context-impl=winfib Win32-Fibers are used as implementation for fiber.

[Note] Note

The first call of fiber converts the thread into a Windows fiber by invoking ConvertThreadToFiber(). If desired, ConvertFiberToThread() has to be called by the user explicitly in order to release resources allocated by ConvertThreadToFiber() (e.g. after using boost.context).


PrevUpHomeNext