Boost logo

Boost :

Subject: Re: [boost] Boost.Fiber mini-review September 4-13
From: Nat Goodspeed (nat_at_[hidden])
Date: 2015-09-04 16:52:38


On Fri, Sep 4, 2015 at 4:33 PM, Thomas Heller <thom.heller_at_[hidden]> wrote:

> On 09/04/2015 10:03 PM, Oliver Kowalke wrote:

>> it is safe to call boost::this_fiber::yield() from main(), e.g. each
>> thread has a main-context/main-fiber

> Ok makes sense. So on a non-fiber context this is essentially a noop? Might
> be a good idea to add this to the documentation.

If I may attempt to clarify your feedback:

I think you're suggesting that the documentation doesn't yet make
clear that this_fiber operations, such as yield(), are valid from
main() and from each new thread function, as well as from
explicitly-launched fibers. Good point.

I'm not sure I understand what you mean by a non-fiber context. In
effect, main() is running on the default fiber for the application's
main thread. Similarly, at entry to a thread function, code is running
on the default fiber for that thread. If you call this_fiber::yield()
without yet having launched any other fibers, it's effectively a
no-op: control detours through the fiber manager and the scheduler,
which concludes that there's only one ready fiber, so the yield() call
returns at once. But such a call is indeed meaningful once you launch
other fibers.

If the documentation were to clarify that yield (et al.) are valid
from main() (et al.), would that address your concern, or would you
also want to see something like the more verbose paragraph above?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk