Opened 7 years ago

Last modified 7 years ago

#11734 closed Feature Requests

future::then(Cont) should be able to execute the contination on undetermined thread — at Version 2

Reported by: viboes Owned by: viboes
Milestone: Boost 1.60.0 Component: thread
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description (last modified by viboes)

Concurrency TS defines future::then() as

"the continuation INVOKE(DECAY_COPY(std::forward<F>(func)), std::move(*this)) is called on an unspecified thread of execution with the call to DECAY_COPY() being evaluated in the thread that called then".

boost::future<T>::then() has more overloads than Concurrency TS. However when not requested explicitly then Boost.Thread should conform to the proposed standard.

As Concurrency TS doesn't have neither async, the future can be created only by a promise or a a packaged_task, so that there are neither futures with launch policy async nor deferred.

In order to be as clear as possible, boost::future<T>::then(Cont) can call the continuation on an unspecified thread of execution.

If the user want other behavior, it can use then(launch_policy, Cont) or then(Executor, Cont) must wrap the continuation.

However the current specification inherit from the parent future when there is no executor nor launch policy.

If there is an interest and in order to provide the current behavior even with a different interface we can add an inherit policy

Before

f.then(c);

After

f.then(launch::inherit, c);

Change History (2)

comment:1 by viboes, 7 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 by viboes, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.