Bill Atkins
2/7/2005 3:53:00 AM
Brilliant! Thanks!
On Mon, 7 Feb 2005 12:50:09 +0900, Assaph Mehr <assaph@gmail.com> wrote:
>
> Bill Atkins wrote:
> > Say I have a thread in variable @thread. Is it possible to stop that
> > thread from the main thread? I am aware of Thread.stop, but I don't
> > want to stop the current thread, just the thread represented in
> > @thread.
>
> Look at Thread#kill. e.g.:
>
> @thread = Thread.new {
> while true
> puts 'still going'
> sleep 2
> end
> }
>
> sleep 7
> @thread.kill
> puts 'done'
>
>
--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"