Boost logo

Boost Users :

Subject: Re: [Boost-users] Fwd: Boost coroutine/context libraries
From: Daniel Hofmann (daniel_at_[hidden])
Date: 2017-01-18 04:36:48


On 01/18/2017 02:20 AM, Gregory Laird wrote:
> --------------- Forwarded message (begin)
>
> Subject: Boost coroutine/context libraries
> From: Gregory Laird <glaird_at_[hidden]>
> Date: Tue, 17 Jan 2017 17:10:57 -0800
> Newsgroup: gmane.comp.lib.boost.user
>
> I am trying to write a cooperative task scheduler in c++ and I have
> discovered the boost context and coroutine libraries. I have written these
> sorts of schedulers many times in assembly language so I appreciate the
> issues in the methodology. I have written lots of c code but am less versed
> in c++.
>
> I have been trying to find some straightforward examples of the libraries
> use without a lot of extraneous c++ language elements (e.g. binds, lambdas,
> etc.). I did find one example
>
> http://stackoverflow.com/questions/11716291/boost-context-class
>
> that is very nice, but it will not compile now with the current boost
> library. I get an error saying that boost::context::fcontext_t has been
> removed from the public api.
>
> Could someone direct me to some examples that demonstrate the context or
> coroutine functionality that would be easier to understand.

Maybe this helps - very basic coroutine "scheduler" example:

https://github.com/daniel-j-h/coroutine-scheduler/blob/master/main.cc

I would go with Boost.Coroutine2 / Boost.Coroutine directly instead of
the lower-level context featuers.

>
> I want to write a scheduler that is very similar to the example listed above
> where coroutines yeild back to a main caller which then chooses the next
> coroutine to continue its processing.
>
> Thanks.
> --------------- Forwarded message (end)
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net