Boost logo

Boost :

Subject: Re: [boost] Executor associated to the future continuations (was [thread] boost::future::then)
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2015-10-30 13:24:43


Le 30/10/15 08:08, Vladimir Prus a écrit :
> On 29-Oct-15 11:00 PM, Vicente J. Botet Escriba wrote:
>> Le 29/10/15 14:09, Vicente J. Botet Escriba a écrit :
>>> Le 29/10/15 11:13, Vladimir Prus a écrit :
>>>> On 29-Oct-15 12:49 PM, Vicente J. Botet Escriba wrote:
>>>>> Le 29/10/15 10:08, Vladimir Prus a écrit :
>>>>>> On 11-Oct-15 9:30 PM, Vicente J. Botet Escriba wrote:
>>>>>>> Le 10/10/15 16:58, Vicente J. Botet Escriba a écrit :
>>>>>>>> Le 10/10/15 15:26, Vicente J. Botet Escriba a écrit :
>>>>>>>>> Le 10/10/15 07:57, Vladimir Prus a écrit :
>>>>>>>>>>
>>>>>> Vicente,
>>>>>>
>>>>>> I've created a very early experiment, here:
>>>>>>
>>>>>> https://gist.github.com/vprus/3a7bea25e4c0a0e4222d
>>>>>>
>>>>>> Does it look generally right for you?
>>>>> I don't know Qt. It seems ok beside tht fact that you create an
>>>>> Executor for each Task. Maybe this is not important for
>>>>> you as your Executor class is adapting Qt.
>>>>
>>>> It's not hugely important, since in practice the work performance
>>>> is orders of magnitude longer
>>>> than QObject creation. Anyway, I possibly can create an executor
>>>> per thread on demand, and reuse them.
>>> Don't worry with the new version where you will give the Executor at
>>> promise creation the cost will be minimal in your
>>> case.
>>>>
>> Hrr, I'm not able to remove completely the Executor type erasure as
>> the type of f2 would depend on the Executor
>> associated to the shared state of f1, that is unknown.
>>
>> MyExecutor ex;
>> auto f1 = async(ex, cont);
>> auto f2 = f1.then(launch::inherit, cont);
>>
>> So, f1 could have a shared_state that depends on MyExecutor, however
>> f2 would have an shared state that depends on the
>> type erased boost::executor.
>
> Okay, but does it matter much for performance?
>
>> That means that it is better for the user to store the specific
>> executor in some way and use it as follow
>>
>> auto f2 = f1.then(ex, cont);
>
> I've tried to do so, at:
>
> https://gist.github.com/vprus/7bb55cc6c6a1d4bbd3c4
>
> This initial version was straight-forward, though it will probably
> need further tweaks for production use.
>
> What does boost::future::then do right now if the continuation returns
> boost::future, is it unwrapped
> automatically?
>
Unfortunately, no. I based my development in the fist proposals.

I have this on to of my to do list already.

Vicente


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