From: Eleanor McHugh Date: 2009-06-10T02:24:04+09:00 Subject: Re: doing something each second On 9 Jun 2009, at 17:13, Charles Oliver Nutter wrote: > On Tue, Jun 9, 2009 at 7:59 AM, Christoph > Jasinski wrote: >> Hi, >> is it possible to execute a block each second for let's say 8 hours >> a day? >> Instead of using threads maybe. Something like this: >> >> Time.each.second do { >> stuff >> } > > There's no way to run something asynchronously every second or trigger > something to run asynchronously every second without a thread of some > kind or without interrupting the flow of the main thread. Why don't > you want to use a thread? It could probably be done with a signal handler, but that's not the kind of code anyone wants to maintain in its raw state. However this does look like a nice idea for a thread abstraction... Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason