标签:winform style blog http color 使用
1 lock (x) 2 { 3 DoSomething(); 4 } 5 6 //the same. 7 8 try 9 { 10 DoSomething(); 11 } 12 finally 13 { 14 System.Threading.Monitor.Exit(obj); 15 }
1 using System; 2 using System.Threading; 3 4 class ThreadingExample 5 { 6 static AutoResetEvent autoEvent; 7 8 static void DoWork() 9 { 10 Console.WriteLine(" worker thread started, now waiting on event..."); 11 autoEvent.WaitOne(); 12 Console.WriteLine(" worker thread reactivated, now exiting..."); 13 } 14 15 static void Main() 16 { 17 autoEvent = new AutoResetEvent(false); 18 19 Console.WriteLine("main thread starting worker thread..."); 20 Thread t = new Thread(DoWork); 21 t.Start(); 22 23 Console.WriteLine("main thread sleeping for 1 second..."); 24 Thread.Sleep(1000); 25 26 Console.WriteLine("main thread signaling worker thread..."); 27 autoEvent.Set(); 28 } 29 }
标签:winform style blog http color 使用
原文地址:http://www.cnblogs.com/robyn/p/3820378.html