In a classic single thread winform application I would like to know if a .NET method can be interrupted by another one.
I know that in some case like for example with the instruction Thread.Sleep(1000); or Application.DoEvents(); then a Timer_Tick can "take" the execution, but is there another case where a method will be interrupted ?
Also if the method is interrupted I would like to know when the execution will come back to the previous method ? At the end of the Timer_Tick ? (if Timer_Tick toke the execution)
bool stopRunning = true), and your main method periodically checks that it should stop mid flight. There isn't a way to hijack you way into the method. stackoverflow.com/questions/744013/…Thread.Sleep(1000);doesn't "interrupt" a method any more than counting to 1 billion 1 billion times does. It just take a long time to execute that one line.Thread.Sleepif you use a WinForms timer. Other types of timers will allow it.