15

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?

Eran
  • 21,632
  • 6
  • 56
  • 89
nogard
  • 9,432
  • 6
  • 33
  • 53
  • 3
    I think they explain that it is an infrastructure for building cooperative multithreading. – Khaled Alshaya Aug 22 '12 at 05:56
  • 2
    The phrase to Google is "cooperative multitasking" (not multithreading -- the point is that it is single-threaded). The biggest advantage is super-fast task switching (that doesn't involve the OS). If you've Googled that and still have questions, then ask away :-) – Travis Gockel Aug 22 '12 at 06:10
  • 2
    Please don't redirect me to Google before you read the question. I'm interested to know SO community opinion on Boost.Context library, share experience of using it, pros and cons comparing to analogs, etc – nogard Aug 23 '12 at 04:39
  • libcppa (C++ Actors) uses Boost.Context, AFAIK – ArtemGr Sep 19 '12 at 22:26

1 Answers1

13

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.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172