From: nobu.nokada@... Date: 2004-07-03T19:29:11+09:00 Subject: Re: assert_timeout for Test::Unit::Assertions Hi, At Sat, 3 Jul 2004 18:20:28 +0900, Kirill A. Shutemov wrote in [ruby-core:03116]: > I write subj. Patch in attachment. Your implementation leaves the thread alive, and changes the execution thread. In addition, the scheme used in timeout.rb could show the backtrace. def assert_timeout(timeout, message='Timeout exceeded!', &block) _wrap_assertion do begin current = Thread.current sentinel = Thread.start do sleep timeout current.raise AssertionFailedError, message if current.alive? end yield ensure sentinel.kill if sentinel and sentinel.alive? end end end -- Nobu Nakada