Interrupting, aborting, and safe canceling the thread execution
Some tasks require ways to forcibly interrupt the execution of the thread. In our previous examples, we've used the
BackgroundWorker objects due to their background operations and the ability to be forcibly closed on exiting the application. Now, let's explain the .NET features that target normal thread interruption and safe cancelation. Each blocking method will block the thread forever if some unblocking condition is never met or the timeout is not set. However, sometimes, you need to cancel thread execution and maybe continue the execution of the application without allowing the thread to continue. In other situations, you need to cancel the thread, for example, to receive ...