Hi,
Sean Parent suggests (See [1] Better Code: Concurrency) to remove the
promise and left the packaged_task serve as single provider of a future.
Both are created at once using the package factory.
His future library doesn't include a shared_future as the future
contains a value that can be observed several times.
The continuation takes the value and not the future. So a future can
have several continuations. If the store type is movable only, then the
future can have only one continuation.
Not really strange coming from Sean, future and packaged_task are
copyables :)
One more thing, there is not get no wait, but a get_try that return an
optional<T>.
Scales better. IIUC the implementation allows to implement when_all on
top of future/packaged_task. The trick is that that the packaged_task
can store some context.
async has always an Scheduler as parameter.
Scheculers are just Copyable Callables having this signature
void(void()). There is no need for function add/spawn.
when_all has also a callable as argument.
I find the Sean's design clean and simple (See the code [2]). What do
you think of it? Do you see any issues on it?
* I don't understand why when_all continuation has the futures as
parameters (I suspect that this is a type on the documentation).
* I would rename get_try to try_get. This function could return
optional