Hi,

At Fri, 7 Jun 2002 09:00:09 +0900,
Dossy wrote:
> What about this:

It's equivalent to:

loop do
  sleep 1.0
  # ... stuff to do every second ...
end

And runs with 1-second intervals, not periodically.

This is based on yours. 

  def periodically(sec, *args)
    loop do
      t = Thread.new {sleep sec}
      yield(*args)
      t.join
    end
  end

  periodically 1.0 do
    p Time.now
    sleep 0.5
  end

-- 
Nobu Nakada