Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost Context library

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?

like image 682
nogard Avatar asked Aug 22 '12 05:08

nogard


People also ask

What is boost context?

Context is a foundational library that provides a sort of cooperative multitasking on a single thread.

What is the use of boost in C++?

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.

What is boost fiber?

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.


1 Answers

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.

like image 194
Jan Hudec Avatar answered Nov 03 '22 08:11

Jan Hudec