真是BT啊...也不知道如何来做,难道是把所有的线程都Hang住么?
( 唱到:如果是这样,你不要悲伤~~~!!!)
用下面这个代码试试看看:
原因如下 (摘自 http://blog.joycode.com/xinz/archive/2004/08/22/31313.aspx ):
( 唱到:如果是这样,你不要悲伤~~~!!!)
用下面这个代码试试看看:
|
原因如下 (摘自 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 |
但是它们有细微而重要的区别,根据这个BLOG :
Thread.Sleep is a little unusual. We can take control of threads that are inside this service. But, following the tradition of Sleep on the underlying Windows operating system, we perform no pumping.
If you need to Sleep on an STA thread, but you want to perform the standard COM and SendMessage pumping, consider Thread.CurrentThread.Join(timeout) as a replacement.