-
Notifications
You must be signed in to change notification settings - Fork 18
Description
There's no way to inject a stop_token into the task posted to the thread pool. In fact there's no real IoAwaitable interface at all. The only options are:
thread_pool tp;
run_async( ex.get_executor() )( my_task() );
co_await run( ex.get_executor() )( my_task() );But what does this even mean? where is the suspension mechanism for run? it blocks on a task submitted to a foreign executor? The injected stop token is.. nothing? should run with no stop token acquire the stop token from the environment in order to connect it to the caller's stop token?
What if someone wants to stop all tasks in the thread pool, there would need to be one stop source and its stop tokens are distributed to every submitted awaitable but there's no way to do that with the current API.
run_async cannot propagate a stop token since its not a coroutine. But run can, and probably should.