What's the equivalent of sleep(), wait(), or pause()

James Pelcis jpelcis at gmail.com
Sun Jul 9 17:44:33 PDT 2006


  > Thread.wait() is not a sleep method - it's what is sometimes called a
> join (as in Java) - it waits for a thread to finish execution. A thread 
> cannot wait for itself to finish, hence the error.

Thread.wait() is indeed that.  If, however, you pass an integer, it will 
wait until it is either terminated or that number of milliseconds has 
passed.  I think the check should be removed for that version.

> We have a static Thread.yield() method and I don't know why there's no 
> Thread.sleep(). It would be nice to have as a cross-platform solution.

I agree.



More information about the Digitalmars-d-learn mailing list