File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =' 1.0' encoding =' utf-8' standalone =' no' ?>
2
+ <!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3
+
4
+ <issue num =" 4347" status =" New" >
5
+ <title ><code >task</code >'s stop source is always created</title >
6
+ <section ><sref ref =" [task.promise]" /></section >
7
+ <submitter >Dietmar Kühl</submitter >
8
+ <date >01 Sep 2025</date >
9
+ <priority >99</priority >
10
+
11
+ <discussion >
12
+ <p >
13
+ The type <code >task< ...> ::promise_type</code > has exposition-only
14
+ members <code ><i >source</i ></code > and <code ><i >token</i ></code >.
15
+ These can be interpreted as always existing which would be a
16
+ performance issue for former and an unnecessary constraints for the
17
+ latter (because stop tokens aren't required to be default constructible).
18
+ </p >
19
+ <p >
20
+ The intent is that the stop token obtained from the
21
+ <code >get_stop_token</code > query of the receiver's environment is
22
+ used. Only if this type is different from the <code >task</code >'s
23
+ <code >stop_token_type</code > a stop source of type
24
+ <code >stop_source_type</code > needs to be created when the
25
+ <code >get_stop_token</code > query is used on the promise type's
26
+ environment. The stop token doesn't need to be stored at all: it
27
+ can either be obtained from the receiver's environment or from the
28
+ stop source. The fix is to show the stop source as an optionally
29
+ present member of of the operation state and it should be of type
30
+ <code >std::optional< stop_source_type> </code > to imply that
31
+ it is only created when accessed.
32
+ </p >
33
+ </discussion >
34
+
35
+ <resolution >
36
+ <p >
37
+ </p >
38
+ </resolution >
39
+
40
+ </issue >
You can’t perform that action at this time.
0 commit comments