In the most recent version of the Boost the new library Context appeared.
After reading the documentation I understood what it does, but can hardly see the use-cases. What are the benefits of using this library? For which tasks you could recommend to use it?
Context is a foundational library that provides a sort of cooperative multitasking on a single thread.
Boost is a set of libraries for the C++ programming language that provides support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing.
Fiber provides a framework for micro-/userland-threads (fibers) scheduled cooperatively. The API contains classes and functions to manage and synchronize fibers similiarly to standard thread support library.
It's a basis for coroutine library, that is under review as of early september 2012, so it should appear in some future release. That will allow easy implementation of things like generators like in python or C# have them.
The context library itself can be compared to scheme's call-with-current-continuation
and call-with-dynamic-root
functions. A basis for various kinds of coroutines, generators and cooperative threads.
Update: Coroutine library is included in Boost since version 1.53.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With