Skip to content

TaskSource-specific TaskCanceller #21119

Closed

Description

@gterzian

In order to support stuff like #21114, we need the ability to cancel tasks in a more granular way, at the level of 'per tasksource'.

Currently 'cancelling' tasks is basically dependent on the ignore_further_async_events field on Window, which is the basis for the TaskCanceller returned via task_canceller, which is accessed via the queue method of the TaskSource trait(via the globalscope passed to that function).

One idea I can come up with is adding a new method to TaskSource, something like
fn choose_canceller<T>(&self, global: &GlobalScope) -> TaskCanceller, and then change queue to read something like the below:

let canceller = self.choose_canceller(&global);
self.queue_with_canceller(task, canceller);

Then each task source will need to implement choose_canceller, calling the appropriate method of GlobalScope, which would forward the call to the window, and the window would require a flag similar to ignore_further_async_events for each task source...

Any better ideas?

Activity

  1. jdm commented on Jul 4, 2018

    @jdm
    Member

    That implementation makes sense to me!

  2. added a commit that references this issue on Jul 10, 2018
    8988d67
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions