From: Stefano Crocco Date: 2006-11-16T23:48:45+09:00 Subject: Re: Threading Question Vincent Fourmond wrote: > So you see, initialize does run the thread. You might want to write an > independent class that would create the thread in the start function. I'm not a thread expert, but I think that something like this should work class Timer def initialize period, count, &action @period=period @count=count @action=action end def start @count.times do |i| t=Thread.new do sleep @period @action.call end t.join end end end t=Timer.new( 3, 4){puts "hello"} t.start -- Posted via http://www.ruby-forum.com/.