by notriddle · 4y ago · 0 comments
It also references Javas deprecated Thread.stop which looks very similar to .Nets Thread.Abort
Emphasis mine. In Rust, "cancellation" happens at well defined "await points".
In Thread.Abort the .Net runtime is just injecting a call to throw into the instructions at potentially any point in the threads code which is obviously problematic although throwing on any await can still cause problem if you're not expecting it. There is no try catching involved because you really can't catch ThreadAbortException instead you are just waiting for the thread to stop with Thread.Join or what ever.
That’s not at all what happens when the Future is dropped in Rust: Yes, it only happens at .await, but when it does, execution is simply stopped dead, no chance to continue.