]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/README.md
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / README.md
1 boost.context
2 =============
3
4 boost.context is a foundational library that provides a sort of cooperative multitasking on a single thread.
5 By providing an abstraction of the current execution state in the current thread, including the stack (with
6 local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context
7 instance represents a specific point in the application's execution path. This is useful for building
8 higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to
9 C# keyword yield in C++.
10
11 A execution_context provides the means to suspend the current execution path and to transfer execution control,
12 thereby permitting another execution_context to run on the current thread. This state full transfer mechanism
13 enables a execution_context to suspend execution from within nested functions and, later, to resume from where it
14 was suspended. While the execution path represented by a execution_context only runs on a single thread, it can be
15 migrated to another thread at any given time.
16
17 A context switch between threads requires system calls (involving the OS kernel), which can cost more than
18 thousand CPU cycles on x86 CPUs. By contrast, transferring control among them requires only fewer than
19 hundred CPU cycles because it does not involve system calls as it is done within a single thread.
20
21 boost.context requires C++11!