Skip to content

exec(at_coroutine_exit): inherit start scheduler only when available#2106

Open
nebkat wants to merge 1 commit into
NVIDIA:mainfrom
nebkat:at-coroutine-exit-optional-scheduler
Open

exec(at_coroutine_exit): inherit start scheduler only when available#2106
nebkat wants to merge 1 commit into
NVIDIA:mainfrom
nebkat:at-coroutine-exit-optional-scheduler

Conversation

@nebkat
Copy link
Copy Markdown

@nebkat nebkat commented Jun 1, 2026

The cleanup task's await_suspend unconditionally reads get_start_scheduler from the parent promise's env, which made at_coroutine_exit impossible to use with tasks whose context doesn't model affinity (e.g. basic_task<T, inline_task_context<T>>): the call failed to compile.

Gate the read on a requires-expression. When the parent's env doesn't expose get_start_scheduler, the cleanup task's __scheduler_ keeps its default value (inline_scheduler{}), which is what callers of an inline task would expect anyway. Affinity-bearing tasks (default_task_context) continue to inherit the parent's scheduler as before.


I understand this may not be desirable due to risk of stop requester running a complex operation but opening to start a discussion. We run a single main event loop on an embedded device so have no need for the scheduler affinity mechanism.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Jun 1, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

The cleanup task's await_suspend unconditionally read get_start_scheduler
from the parent promise's env, which made at_coroutine_exit impossible
to use with tasks whose context doesn't model affinity (e.g.
basic_task<T, inline_task_context<T>>): the call failed to compile.

Gate the read on a requires-expression. When the parent's env doesn't
expose get_start_scheduler, the cleanup task's __scheduler_ keeps its
default value (inline_scheduler{}), which is what callers of an inline
task would expect anyway. Affinity-bearing tasks (default_task_context)
continue to inherit the parent's scheduler as before.
@nebkat nebkat force-pushed the at-coroutine-exit-optional-scheduler branch from b69360f to da40fc2 Compare June 1, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant