C# Thread Sleep vs. Synchronize vs. ThreadPool ???
Posted on 2004-08-27
The code below works quite well although I must admit I don't completly understand it. I placed the Class1 last so the Thread.Sleep would control it. The Class1 run most of the time while Class1 has a breif but effective interval to complete it's task. I think the code I have may prove to be unpredicable in the long run..........
1. Why would C# use syntax like 'Thread.Sleep' instead of say 't1.Sleep' or t2.Sleep', etc...???
2. What 'delay' or timing effect does the 'for' statement have???
3. Would Sychronize or ThreadPool work more efficiently???
private void Form1_Load(object sender, System.EventArgs e)
Class2 objClass2 = new Class2();
Thread t2 = new Thread(new ThreadStart(objClass2.StartLookUp));
Class1 objClass1 = new Class1();
Thread t1 = new Thread(new ThreadStart(objClass1.StartServer));
for (int i=0; i < 10; i++)