Skip to content

Consider if its at all possible to make context cancellation safe #38

@kammce

Description

@kammce

Currently we have unsafe_cancel() as an API to async::context. The problem is that when we destroy all of the promises, we do not set their futures the the cancelled state. This is actually fine for all futures except for those that exist within a supervisor. I'm going to be calling anything that has position of a free future that can be supervised, as a supervisor. For example, a coroutine with a proxy is a supervisor. The main function is a supervisor if it creates a context and sets up future. Supervisors are the only types of functions that can encounter an invalid future. A future with its coroutine handle initialized, but the promise has been destroyed. If we could somehow set the state of the top level futures to cancelled, then we make context destruction safe, ensuring users cannot footgun themselves.

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