Boost logo

Boost :

Subject: Re: [boost] Futures vs async_result
From: Bjorn Reese (breese_at_[hidden])
Date: 2015-07-27 11:03:21

On 07/27/2015 09:54 AM, Michael Caisse wrote:

> Future continuations are fine when the sequence from start to end
> doesn't branch. I am cautious of their usefulness in the general case
> still. It isn't uncommon to make choices in a completion handler to
> queue different async actions with different completion handlers.

You hit the nail on the head. This is one of the main reasons why I
seldomly use futures for asynchronous operations. Instead I prefer
coroutines (and callbacks for simple sequences) over futures as the
use of future continuations quickly becomes unwieldy in reality.
async_result gives me the freedom to choose whatever mechanism is
appropriate for my application.

I suspect that Niall's preference for (his own) futures is due to
something that has only been mentioned briefly in this discussion.

AFIO operations are launched in a two-step process:

   1. An operation is scheduled for execution (e.g. dispatcher::file()
      for opening a file.)
   2. The operation is executed (e.g. dispatcher::call().)

Using this two-step approach allows us to schedule batches of dependent
operations before they are executed.

When we batch operations together we should be able to express
dependencies between them. Niall uses his own futures for that.

Boost list run by bdawes at, gregod at, cpdaniel at, john at