Skip to content
Discussion options

You must be logged in to vote

There's no public hook that runs before cancel_all() in 8.2.8, but what Textual already guarantees is enough to gate publishing:

  • self.workers.cancel_all() is in the finally: of App._process_messages, so it runs however the loop ends: exit(), an exception, or the message-loop task being cancelled directly.
  • Worker.cancel() is synchronous. It sets is_cancelled (and the threading cancelled_event) in the same call that does task.cancel(), so on the event loop the flag is set the moment cancellation is requested.

One ordering difference I found: under run_test() the context manager calls app._shutdown() itself on exit, so on_unmount runs before cancel_all() there, while under run() / run_async()

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by omovomo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants