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:
parent
cd08b1cbff
commit
37e59f5583
2 changed files with 12 additions and 2 deletions
|
@ -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>
|
||||
|
||||
* vm_method.c (rb_add_method_def): workarond fix for redefinition
|
||||
|
|
|
@ -46,8 +46,13 @@ module Timeout
|
|||
begin
|
||||
x = Thread.current
|
||||
y = Thread.start {
|
||||
sleep sec
|
||||
x.raise exception, "execution expired" if x.alive?
|
||||
begin
|
||||
sleep sec
|
||||
rescue => e
|
||||
x.raise e
|
||||
else
|
||||
x.raise exception, "execution expired" if x.alive?
|
||||
end
|
||||
}
|
||||
return yield(sec)
|
||||
rescue exception => e
|
||||
|
|
Loading…
Add table
Reference in a new issue