Heaven 要测试SQL Server 2005的镜像功能,居然要写个代码把程序停止响应![1]
[入库:2006年2月23日] [更新:2007年3月24日]
真是BT啊...也不知道如何来做,难道是把所有的线程都Hang住么?
( 唱到:如果是这样,你不要悲伤~~~!!!)
用下面这个代码试试看看:
1 using System; 2 using System.Threading; 3 4 public class Test { 5 public static void Main(String[] args) { 6 //Thread.CurrentThread.Sleep(500); 7 Thread.CurrentThread.Join(5000000); 8 Console.WriteLine("874 Heaven * 100"); 9 } 10 }
|
原因如下 (摘自
http://blog.joycode.com/xinz/archive/2004/08/22/31313.aspx ):
|
Thread.Join
Blocks the calling thread until a thread terminates or the specified time elapses.
|
|
Thread.Sleep Blocks the current thread for the specified number of milliseconds.
|
本文关键:Heaven 要测试SQL Server 2005的镜像功能,居然要写个代码把程序停止响应!
本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)