From: "Iñaki Baz Castillo" Date: 2008-09-10T23:00:16+09:00 Subject: Re: Difference between "sleep()" and "Thread.stop"? 2008/9/10, Robert Klemme : > 2008/9/10 Iñaki Baz Castillo : > > > Hi, is there any difference between doing: > > > > sleep > > > > and: > > > > Thread.stop > > > > > #sleep resumes automatically after a given time, #stop does not. Object#sleep doesn't resume if there is not parameter: sleep # This sleeps forever So, which difference exists between Object#sleep (with no parameter) and Thread#stop ? > > In both cases the current thread is in "sleep" state. > > > > Also, why there is no way to stop/pause/sleep a thread different of the current? > > I mean something as: > > > > t1 = Thread.current > > Thread.new { t1.sleep } <--- This doesn't exist (neither #stop or #pause) > > > Why should it? With threads you use other mechanisms to control > execution, e.g. a blocking queue, synchronizing on a mutex etc. Well, it was just curiosity. Thanks for clarification. Thanks. -- Iñaki Baz Castillo