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

caller.  [ruby-dev:41010]'


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-04-19 03:46:17 +00:00
parent 505def84d4
commit 23f9ffbf35
3 changed files with 19 additions and 6 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]'
Sat Apr 17 09:04:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Apr 17 09:04:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (--with-{ruby-version,{site,vendor}dir}): use * configure.in (--with-{ruby-version,{site,vendor}dir}): use

View file

@ -56,8 +56,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
} }
yield sec yield sec
# return true # return true
@ -73,7 +78,10 @@ module Timeout
# would be expected outside. # would be expected outside.
raise Error, e.message, e.backtrace raise Error, e.message, e.backtrace
ensure ensure
y.kill if y and y.alive? if y and y.alive?
y.kill
y.join # make sure y is dead.
end
end end
end end

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.8" #define RUBY_VERSION "1.8.8"
#define RUBY_RELEASE_DATE "2010-04-17" #define RUBY_RELEASE_DATE "2010-04-19"
#define RUBY_VERSION_CODE 188 #define RUBY_VERSION_CODE 188
#define RUBY_RELEASE_CODE 20100417 #define RUBY_RELEASE_CODE 20100419
#define RUBY_PATCHLEVEL -1 #define RUBY_PATCHLEVEL -1
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 8 #define RUBY_VERSION_TEENY 8
#define RUBY_RELEASE_YEAR 2010 #define RUBY_RELEASE_YEAR 2010
#define RUBY_RELEASE_MONTH 4 #define RUBY_RELEASE_MONTH 4
#define RUBY_RELEASE_DAY 17 #define RUBY_RELEASE_DAY 19
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];