From: Sam Duncan Date: 2011-10-12T03:46:31+09:00 Subject: Re: scheduler and thread On 12/10/11 05:04, lover ruby wrote: > Robert Klemme wrote in post #1026082: >> On Tue, Oct 11, 2011 at 8:08 AM, lover ruby >> wrote: >>>>> 1318284733 >>>> loop do >>>> @timer.kill >>>> >>>> Sam >>> UI.start_timer, every code is executable. So the UI.start_timer acts >>> like a background process. >> Then you must not #join in the method that start the thread as Sam >> explained. >> >> Example: >> https://gist.github.com/1278320 >> >> Kind regards >> >> robert > Thanks > I tried you code, but still need sleep 20. what I really want > > require 'timer' > Timer.repeat_every(5) do > puts Time.now.to_i > end > > puts "Doing other stuff..." > #sleep 20 > > The output will be > "Doing other stuff..." > 1318348633 > 1318348638 > 1318348643 > 1318348633 > 1318348638 > 1318348643 > ..........Forever, always print out number every 5 seconds > Can you explain what you mean by "still need sleep 20"? Sam