Subject: Re: [boost] Boost.Pipeline -- scheduling of segments
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2014-07-09 14:22:59
2014-07-09 19:33 GMT+02:00 Benedek Thaler <thalerbenedek_at_[hidden]>:
> Currently, I'm experimenting with coroutines, I think (hope) there is a way
> we could provide an interface like this:
> void duplicate(int input, queue_back<int>& output)
> push_or_yield enqueues the element, or if the queue is full: the coroutine
> yields and tries to enter the monitor of the downstream task. If it's
> already taken, pick another task. If there is no such task, block until a
> task becomes available. (or spin on the previous task a bit)
that's exactly what boost.fibers provide (fibers are coroutines + scheduler
+ synch. classes).
a fiber gets suspended if it calls bounded_queue<>::push() and the queue if
(un)bounded_queue<>::pop() if the queue is empty.
the hosting thread is not blocked an can execute other tasks in the mean