Go to file
Oliver Kowalke bd493f77d8
Merge pull request #122 from janisozaur/patch-1
Fix compilation with MSVC for ARM
2019-10-23 11:34:13 +02:00
build Fix ppc32 on Linux musl, NetBSD, OpenBSD; fixes #120 2019-10-19 14:06:24 -04:00
doc docu: sanitizer support 2019-10-02 08:17:24 +02:00
example execution_context removed 2019-08-29 13:42:03 +02:00
include/boost/context Fix compilation with MSVC for ARM 2019-10-16 22:45:12 +02:00
meta Update libraries.json 2016-07-04 10:14:47 +02:00
performance execution_context removed 2019-08-29 13:42:03 +02:00
src Fix ppc32 on Linux musl, NetBSD, OpenBSD; fixes #120 2019-10-19 14:06:24 -04:00
test Use mmap(2) MAP_STACK to allocate stacks on OpenBSD 2019-10-03 20:47:36 -04:00
.gitattributes Move top-level boost directory over to "devel" (temporarily) 2007-07-31 20:32:15 +00:00
.gitignore add gitignore-file 2013-12-03 18:57:14 +01:00
.travis.yml add control file for Travice CI 2017-12-20 15:33:01 +01:00
index.html context: Remove some doc build settings + redirect for documentation. 2012-06-30 19:24:00 +00:00
README.md Update README.md 2019-02-02 12:59:32 +01:00

boost.context

boost.context is a foundational library that provides a sort of cooperative multitasking on a single thread. By providing an abstraction of the current execution state in the current thread, including the stack (with local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context instance represents a specific point in the application's execution path. This is useful for building higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to C# keyword yield in C++.

A fiber provides the means to suspend the current execution path and to transfer execution control, thereby permitting another fiber to run on the current thread. This state full transfer mechanism enables a fiber to suspend execution from within nested functions and, later, to resume from where it was suspended. While the execution path represented by a fiber only runs on a single thread, it can be migrated to another thread at any given time.

A context switch between threads requires system calls (involving the OS kernel), which can cost more than thousand CPU cycles on x86 CPUs. By contrast, transferring control among fibers requires only fewer than hundred CPU cycles because it does not involve system calls as it is done within a single thread.

boost.context requires C++11!