1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/timeout.rb (Timeout#timeout): propagate errors to the

caller.  [ruby-dev:41010]'


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-04-19 03:46:17 +00:00
parent cd08b1cbff
commit 37e59f5583
2 changed files with 12 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Mon Apr 19 12:46:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/timeout.rb (Timeout#timeout): propagate errors to the
caller. [ruby-dev:41010]'
Mon Apr 19 00:27:03 2010 NARUSE, Yui <naruse@ruby-lang.org> Mon Apr 19 00:27:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
* vm_method.c (rb_add_method_def): workarond fix for redefinition * vm_method.c (rb_add_method_def): workarond fix for redefinition

View file

@ -46,8 +46,13 @@ module Timeout
begin begin
x = Thread.current x = Thread.current
y = Thread.start { y = Thread.start {
sleep sec begin
x.raise exception, "execution expired" if x.alive? sleep sec
rescue => e
x.raise e
else
x.raise exception, "execution expired" if x.alive?
end
} }
return yield(sec) return yield(sec)
rescue exception => e rescue exception => e