48248
![Difference between Thread.Sleep(period) and Thread.CurrentThread.Join(period) [duplicate]](https://www.xszz.org/skin/wt/rpic/t5.jpg)
Question:
This question already has an answer here:
<ul><li> <a href="/questions/17072576/when-does-thread-currentthread-join-make-sense" dir="ltr" rel="nofollow">When does Thread.CurrentThread.Join() make sense?</a> <span class="question-originals-answer-count"> 4 answers </span> </li> </ul>Somebody could explain to me what is exactly the difference between Thread.Sleep(period) and Thread.CurrentThread.Join(period)?
Answer1:Well, Thread.Sleep
blocks the thread for a specific amount of time while Thread.Join
blocks it until the target thread has terminated.
Considering that Thread.CurrentThread
is not going to be terminated while it's suspended (even if it is terminated externally that makes no difference because it's dead), the end result is going to be the same. However, using Join
is confusing while Sleep
is obvious. Deciding which one to use is no contest.