Created on 2025-09-01.00:00:00 last changed 2 weeks ago
The type task<...>::promise_type
has exposition-only
members source
and token
.
These can be interpreted as always existing which would be a
performance issue for former and an unnecessary constraints for the
latter (because stop tokens aren't required to be default constructible).
The intent is that the stop token obtained from the
get_stop_token
query of the receiver's environment is
used. Only if this type is different from the task
's
stop_token_type
a stop source of type
stop_source_type
needs to be created when the
get_stop_token
query is used on the promise type's
environment. The stop token doesn't need to be stored at all: it
can either be obtained from the receiver's environment or from the
stop source. The fix is to show the stop source as an optionally
present member of of the operation state and it should be of type
std::optional<stop_source_type>
to imply that
it is only created when accessed.
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-09-01 00:00:00 | admin | create |