Opened 3 years ago

Last modified 3 years ago

#11717 assigned Feature Requests

Associate an Executor used to launch the continuation to a promise/packaged_task constructor.

Reported by: viboes Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

Currently we have async function that constructs futures associated to an Executor.

The then() member function should use this executor to launch the continuation. See #11716.

But futures can also have other sources, as e.g. a promise or a packaged_task. This paper proposes the addition of Executor aware constructors for promise<T> and packaged_task<R(Args)> so that the continuation on the associated future make use of this executor.

We propose to:

  • Add promise<T>::promise<T>(Executor&) Executor aware constructor.
  • Add packaged_task<R(Args...)>::packaged_task(Executor&) Executor aware constructor.

Change History (2)

comment:1 Changed 3 years ago by viboes

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 Changed 3 years ago by viboes

This commit contains a fix for #11716 as well as the addition of the VERY-EXPERIMENTAL promise::set_executor and packaged_task::set_executor. These should be replaced by constructor.

https://github.com/boostorg/thread/commit/b8db8fef8b28414d16c66761badc1c6fcadfc38f

Note: See TracTickets for help on using tickets.