This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
task::stop_token_typeSection: 33.13.6.4 [task.state] Status: New Submitter: Tomasz Kamiński Opened: 2025-12-08 Last modified: 2025-12-12
Priority: Not Prioritized
View all issues with New status.
Discussion:
Addresses US 249-379
It is not clear what bullet [ask.stat] p4.6 is – it reads like a requirement on stop_token_type,
but if so, this paragraph is a poor place for it.
[2025-12-05 Tomasz comments]
The paragraph expresses requirements on user supplied Environment::stop_source_type,
that needs to model stoppable-source, which includes stoppable-callback-for
on associated token. We should also require that Environment::scheduler_type shall satisfy scheduler.
We also need to clarify that stop_possible and stop_requested on prom.token returns
same value as st during lifetime of asynchronous operation.
Proposed resolution:
This wording is relative to N5014.
Modify 33.13.6 [exec.task] as indicated:
-5-
allocator_typeshall meet the Cpp17Allocator requirements,scheduler_typeshall modelscheduler, andstop_source_typeshall modelstoppable-source.
Modify 33.13.6.4 [task.state] as indicated:
void start() & noexcept;
-4- Effects: Effects: Let
prombe the objecthandle.promise(). AssociatesSTATE(prom),RCVR(prom), andSCHED(prom)with*thisas follows:Let
- -4.1- […]
- -4.2- […]
- -4.3- […]
stbeget_stop_token(get_env(rcvr)). Initializesprom.tokenandprom.sourcesuch that during lifetime of the asynchronous operation (33.3 [exec.async.ops]) associated with*this
- -4.4-
prom.token.stop_requested()returnsst.stop_requested();- -4.5-
prom.token.stop_possible()returnsst.stop_possible();.-4.6- for typesFnandInitsuch that bothinvocable<Fn>andconstructible_from<Fn, Init>are modeled,stop_token_type::callback_type<Fn>modelsstoppable-callback-for<Fn, stop_token_type, Init>.