From f6ecebeae98655de4a3d0dbe3221ddf53360af1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dietmar=20K=C3=BChl?=
+The wording for
+An alternative resolution it have
+Change the declaration of task
is not actually started lazilytask<...>::promise_type::initial_suspend
+in [task.promise] paragraph 6
+(second bullet) may imply that a task is eagerly started, i.e., that the
+awaiter return from initial_suspend()
immediately starts
+the scheduling operation and cause the task
to be resumed. At
+the very least the second bullet of the wording should be clarified such
+that the scheduling operation is only started when the coroutine gets
+resumed.
+initial_suspend()
+return std::suspend_always
implicitly requiring that
+the task
gets start()
ed from the correct
+execution context. This approach has the advantage of avoiding
+unnecessary scheduling operations for the likely common case when
+task
s are started from the correct context.
+initial_suspend()
in the synopsis
+of [task.promise] to use
+suspend_always
, directly provide a definition, and add
+various qualifiers:
+
+
+
+namespace std::execution {
+ template<class T, class Environment>
+ class task<T, Environment>::promise_type {
+ ...
+
+autostatic constexpr suspend_always initial_suspend() noexcept;{ return {}; }
+ ...
+ };
+
+}
+
+Remove [task.promise] paragraph 6 entirely: +
++ + + + From b49df63421413d8da79670a29dcee1f2e7e3bf6d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely+auto initial_suspend() noexcept;+
-6- Returns: An awaitable object of unspecified type ([expr.await]) whose member functions arrange for+
-6.1- - the calling coroutine to be suspended,+
-6.2- - the coroutine to be resumed on an execution agent of the execution resource associated withSCHED(*this)
.
The wording for
Change the declaration of task<...>::promise_type::initial_suspend
-in [task.promise] paragraph 6
+in initial_suspend()
immediately starts
the scheduling operation and cause the task
to be resumed. At
@@ -32,7 +32,7 @@ unnecessary scheduling operations for the likely common case when
initial_suspend()
in the synopsis
-of [task.promise] to use
+of suspend_always
, directly provide a definition, and add
various qualifiers:
@@ -50,7 +50,7 @@ namespace std::execution {
-Remove [task.promise] paragraph 6 entirely:
+Remove
auto initial_suspend() noexcept;From 6dbe27f313ac49830d6668a5bb580ac95a18ff9c Mon Sep 17 00:00:00 2001 From: Jonathan Wakely
-6- Returns: An awaitable object of unspecified type ([expr.await]) whose member functions arrange forDate: Mon, 1 Sep 2025 21:29:15 +0100 Subject: [PATCH 3/3] Update xml/issue4349.xml --- xml/issue4349.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/issue4349.xml b/xml/issue4349.xml index 76868e3cd6..1aada82a3c 100644 --- a/xml/issue4349.xml +++ b/xml/issue4349.xml @@ -11,7 +11,7 @@ The wording for
task<...>::promise_type::initial_suspend
-inparagraph 6 +in paragraph 6 (second bullet) may imply that a task is eagerly started, i.e., that the awaiter return from initial_suspend()
immediately starts the scheduling operation and cause thetask
to be resumed. At