Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
build/ | 12-May-2024 | - | 986 | 883 | ||
doc/ | 12-May-2024 | - | 13,678 | 12,826 | ||
example/ | 12-May-2024 | - | 1,522 | 1,105 | ||
meta/ | 12-May-2024 | - | 16 | 15 | ||
performance/ | 12-May-2024 | - | 699 | 536 | ||
src/ | 12-May-2024 | - | 9,410 | 4,916 | ||
test/ | 12-May-2024 | - | 2,072 | 1,819 | ||
README.md | D | 12-May-2024 | 1.4 KiB | 22 | 17 | |
index.html | D | 12-May-2024 | 491 | 15 | 14 |
README.md
1boost.context 2============= 3 4boost.context is a foundational library that provides a sort of cooperative multitasking on a single thread. 5By providing an abstraction of the current execution state in the current thread, including the stack (with 6local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context 7instance represents a specific point in the application's execution path. This is useful for building 8higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to 9C# keyword yield in C++. 10 11A fiber provides the means to suspend the current execution path and to transfer execution control, 12thereby permitting another fiber to run on the current thread. This state full transfer mechanism 13enables a fiber to suspend execution from within nested functions and, later, to resume from where it 14was suspended. While the execution path represented by a fiber only runs on a single thread, it can be 15migrated to another thread at any given time. 16 17A context switch between threads requires system calls (involving the OS kernel), which can cost more than 18thousand CPU cycles on x86 CPUs. By contrast, transferring control among fibers requires only fewer than 19hundred CPU cycles because it does not involve system calls as it is done within a single thread. 20 21boost.context requires C++11! 22