Skip to content

[WIP] Allow cancellation between reschedule() called and task resumed - #3496

Closed
arthur-tacca wants to merge 1 commit into
python-trio:mainfrom
arthur-tacca:allow-cancellation-after-reschedule
Closed

[WIP] Allow cancellation between reschedule() called and task resumed#3496
arthur-tacca wants to merge 1 commit into
python-trio:mainfrom
arthur-tacca:allow-cancellation-after-reschedule

Conversation

@arthur-tacca

Copy link
Copy Markdown
Contributor

Fixes #2973

  • reschedule() gets a new parameter allow_abort: bool which, if True, still allows the abort function to be called right up until the task actually resumed. It is False by default so it's backwards compatible.
  • When Event.wait() is woken by Event.set() it uses this parameter, so cancellation of it always succeeds

Not ready to merge I think the code is fine but:

  • No tests
  • No docs

@arthur-tacca

Copy link
Copy Markdown
Contributor Author

As njsmith's comment says, the wait_task_reschedule() API is already complicated enough and this increases that for little demonstrable benefit. Closing.

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.

Cancellation may not always immediately happen at checkpoints

1 participant