First of all, there are many cases where Sleep()
is misused, for example to "synchronize" threads or to regularily poll a value where a notification function would do (In Win32 WaitForSingleObject
for example)
But what about other use cases? Is Sleep
always evil? If no, what are good use cases for Sleep
? If yes, why do almost all languages have some kind of Sleep
statement?
PS: I've asked this question because of one of the comments of another question. There the OP states, that in his opinion, Sleep
is to be avoided like goto
.