Go to file
Oliver Kowalke f5d062c939
Merge pull request #250 from cjeker/fix_test_fcontext_for_map_stack
Add the BOOST_CONTEXT_USE_MAP_STACK logic to test_fcontext.cpp
2024-03-10 20:23:04 +01:00
.drone add drone config [ci skip] 2021-01-21 19:37:06 +00:00
.github/workflows CI: Test multiple architectures 2022-09-19 05:04:17 +03:00
build Merge pull request #251 from cjeker/sparc64_asm_support 2024-03-10 20:18:12 +01:00
cmake Add windows arm64 fcontext support 2022-06-26 09:51:30 +08:00
doc update documentation 2024-03-10 20:20:54 +01:00
example Revert "support for spawning fiber managed by boost.asio" 2021-10-16 10:52:47 +02:00
include/boost/context Fix check for BOOST_OS_MACOS 2023-08-18 15:57:26 +04:00
meta Move cxxstd json field to end. 2020-12-15 21:54:35 -05:00
performance -fsplit-stack flag with GCC 2020-06-26 17:50:15 +02:00
src Implement the fcontext asm for sparc64 2024-02-13 11:16:42 +01:00
test Add the BOOST_CONTEXT_USE_MAP_STACK logic to test_fcontext.cpp 2024-02-13 10:57:26 +01:00
.drone.star add drone config [ci skip] 2021-01-21 19:37:06 +00: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
CMakeLists.txt CMake: Fix assembler `--defsym` format issue (qcc/qnx) 2023-09-06 13:46:42 +02:00
README.md Update README.md 2019-02-02 12:59:32 +01:00
index.html context: Remove some doc build settings + redirect for documentation. 2012-06-30 19:24:00 +00:00

README.md

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!