C# How to pause/suspend a thread then continue it?

Posted by Russ K on Stack Overflow See other posts from Stack Overflow or by Russ K
Published on 2010-03-12T06:32:54Z Indexed on 2010/03/12 6:37 UTC
Read the original article Hit count: 253

Filed under:
|
|
|
|

I am making an application in C# which uses a winform as the GUI and a separate thread which is running in the background automatically changing things. Ex:

public void run() { while(true) { printMessageOnGui("Hey"); Thread.Sleep(2000); . . } }

How would I make it pause anywhere in the loop, because one iteration of the loop takes around 30 seconds. So I wouldnt want to pause it after its done one loop, I want to pause it on time.

Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about threads