C# Thread.Sleep() 和 threadreference.Join() 有什么区别?
C# Thread.Sleep() 和 threadreference.Join() 有什么区别?
What is the difference between C# Thread.Sleep() and threadreference.Join()?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Sleep 是一种将线程挂起一段时间的方法。它作用于单个线程。
Join 是一种挂起线程直到另一个线程完成的方法。它可以配置为无限休眠,直到该线程完成或有限的时间段或直到另一个线程完成。这是一种多线程之间同步的方法。
Sleep is a method which suspends a thread for a period of time. It acts on a single thread.
Join is a method which suspends a thread until another thread has finished. It can be configured to sleep infinitely until that thread completes or for a finite period of time or until the other thread completes. This is a method for synchronization between multiple threads.
Sleep 使当前线程休眠指定的时间。 Join 将等待(阻塞)当前线程,直到引用的线程完成。
Sleep causes the current thread to sleep for the specified amount of time. Join will wait (block) the current thread until the referenced thread completes.