|
Boost : |
Subject: Re: [boost] [thread] request for interest in new c++1y features
From: Evan Wallace (onlyone_at_[hidden])
Date: 2012-10-20 11:03:11
Bjorn Reese <breese <at> mail1.stofanet.dk> writes:
> The future.then proposal looks very useful.
>
> It is unclear to me, however, what happens if the async call returns
> before .then is hooked up. Will the .then function be executed in the
> calling thread?
>
The answer to this depends on the situation. The paper states that
"The continuation launches according to the specified policy or scheduler".
I would interpret this to mean that the continuation is run as if by a call
to std::async in the first thread to have both a .then continuation set
and a value available (so -- in the .then thread if the future already
contains a result at the time of the call to .then, and in the thread that
fills the future, if the future did not yet contain a result when .then was
called).
Evan Wallace
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk