Boost logo

Boost :

Subject: Re: [boost] Common future base class (was Re: Boost.Fibermini-review September 4-13)
From: Nat Goodspeed (nat_at_[hidden])
Date: 2015-09-07 11:30:57


On Sun, Sep 6, 2015 at 2:07 PM, Hartmut Kaiser <hartmut.kaiser_at_[hidden]> wrote:

>> I've always found when_any much more interesting than when_all. Is it as
>> trivial to implement with await as when_all?

> Nod, I agree. However, I have not found a clever way to do that yet.

On Mon, Sep 7, 2015 at 9:39 AM, Anthony Williams <anthony.ajw_at_[hidden]> wrote:

> On 07/09/15 14:36, Agustín K-ballo Bergé wrote:

>> On 9/7/2015 4:32 AM, Anthony Williams wrote:

>>> On 03/09/15 16:47, Agustín K-ballo Bergé wrote:

>>>> calling `set_value` on the same instance from different
>>>> threads concurrently is expected to work, as in only one (unspecified)
>>>> of them will actually make the shared state ready while all the others
>>>> would throw `promise_already_satisfied`?

>>> Yes, that was the intent. I've got an example that does exactly that in
>>> chapter 8 of my book.

>> Could you describe briefly what this example does? Is it just workers
>> racing (in the good sense) to satisfy the promise? Or does serialization
>> of set_xxx calls matter?

> It's just workers racing to satisfy the promise. The first one to do so
> sets the value, the rest get an exception.

Seems like that could be the basis for a nice when_any?


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