From: Daniel Berger Date: 2006-06-10T01:22:06+09:00 Subject: Re: Package idea: attempt ara.t.howard@noaa.gov wrote: > On Sat, 10 Jun 2006, Daniel Berger wrote: > >> It would error out at 90 seconds no matter what (the value we set to >> 'max'). I'm not sure if that's possible, however, or even how you >> would implement it. Thoughts? > > something like: > > > def done > synchronize(:SH){ @done } > end > > def done=d > synchronize(:EX){ @done=d } > end > > def ensure_max! > @max ||= Thread.new(max, Thread.current) do |m,c| > sleep max > c.raise MaxError unless done > end > end > > def attempt > ... > ensure > @max.kill > end > > > or something like that ;-) > > -a Hm....this has potential. I might be asking you for some help in the future. Thanks, Dan