Boost logo

Boost :

Subject: Re: [boost] Executor associated to the future continuations (was [thread] boost::future::then)
From: Vladimir Prus (vladimir.prus_at_[hidden])
Date: 2015-10-29 06:13:18

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 :
>>>>>> So, the function must be executed in different thread from all the continuations,
>>>>>> and it would seem I'd need to something set executor on promise for that to work?
>>>>> I will see how adding an Executor parameter to promise, packaged_task constructors and
>>>>> make_ready_future/make_exceptional_future could be implemented if this will solve your use case.
>>>> I've create to track this feature request
>>> This commit contains a fix for this issue as well as the addition of the VERY-EXPERIMENTAL promise::set_executor and
>>> packaged_task::set_executor. These should be replaced by constructors having an executor as parameter.
>> Vicente,
>> I've created a very early experiment, here:
>> 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.

>> I'm worried that Executor interface requires methods like
>> close/closed,
> This is used to shutdown smoothly the worker threads.

So where will ::close be called? Is it ever called from boost::thread? That seems unlikely, since boost::thread
does not know at which point I no longer need an executor. And if boost::thread does not call this,
why am I required to implement this method at all?

>> try_executing_once and reschedule_until that don't seem documented in detail.
> These should be put in another concept refining executor. I will try to do it for 1.61.
>> Is
>> it fine to leave them undocumented in my case?
> Well, I don't know what do you mean by undocumented and in your case. Document for what?

I meant 'unimplemented' - will try_executing_once and reschedule_until be ever called in
my case? If not, which you seem to indicate above, then everything is fine.

- Volodya

Vladimir Prus

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