Skip to content

Maybe rework run_in_worker_thread API for cancellation handling? #60

@njsmith

Description

@njsmith

Right now we just have a boolean flag, and it's name is maybe a bit misleading. Maybe it would be better to make it like:

run_in_worker_thread(..., on_cancel="abandon" or "carry-on")

and maybe there should be some option beyond these for actually signaling the thread? Like you can say on_cancel=my_list and we'll append something to the list if you're cancelled so you can occasionally do if my_list: abort()? Or maybe even append the cancel raiser function so it's like if my_list: my_list[0]()? But really this shouldn't be used for complex operations that are frequently returning to Python mode to check a value like this...

Even if we only want those two options for run_in_worker_thread, we probably want more options for the eventual run_in_worker_process -- like on_cancel="kill".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions