It's more like thread cancellation than an interrupt.
Few languages do cancellation well. Either it doesn't work right, or it does something overly elaborate like LISP breaks.
Few languages do cancellation well. Either it doesn't work right, or it does something overly elaborate like LISP breaks.
Sounds spooky, and it does require writing code in an exception-safe way, but that’s generally easy: pure code is largely exception-safe by nature, and impure code can use “bracket” (“finally”, “mask”, “ResourceT”, &c.) to acquire & release resources—and should already be using these functions anyway to handle regular synchronous exceptions. Async exceptions are very useful for killing a task that’s using too much time/memory, or initiating a graceful shutdown.