Skip to content

Check if initial_suspend can be used to detect context operation stacking #65

Description

@kammce

See libhal/async_context:README.md#Avoid Operation Stacking for what operation stacking is.

When we create a top level coroutine we know that initial suspend is called and the coroutine does not proceed. The question is, does this only happen to top level coroutines? Does this step get bypassed if you co_await the future. If it is the case that initial_suspend is skipped when a future is co_awaited, then we can use this to check if the context's memory usage is non-zero. If its non-zero then we know that its preloaded.

But this assumes that somehow co_awaiting a future changes what happens when the coroutine's factory function is called. I'm not sure if there is such an asymmetry.

Activity

  1. kammce commented on Apr 19, 2026

    @kammce
    MemberAuthor

    This is obsolete as I determined that its better to stack operations at the point in which the future is created from the promise's get_return_object. The continuation for the context is always set to whatever was the active coroutine within the context.

  2. kammce commented on Apr 19, 2026

    @kammce
    MemberAuthor

    The PR that did this: #89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions