As we know each timer elapsed method callbacks on a separate thread. Is there a way to abort the timer thread in c#? Suppose a timer thread is blocked in a long running operation. How would a new thread abort the blocked thread? the Thread.CurrentThread points to the calling thread instead of the blocked thread.
Share
Aborting threads results in asynchronous exception. So the best way to abort threads is not to abort at all. Instead use mutex and semaphores to signal cancellation and then continuously poll for the cancellation state. if cancel is signaled do nothing.