ruby-changes:16242
From: shyouhei <ko1@a...>
Date: Tue, 8 Jun 2010 15:25:48 +0900 (JST)
Subject: [ruby-changes:16242] Ruby:r28209 (ruby_1_8_7): merge revision(s) 27394:27397:
shyouhei 2010-06-08 15:24:25 +0900 (Tue, 08 Jun 2010) New Revision: 28209 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28209 Log: merge revision(s) 27394:27397: * lib/timeout.rb (Timeout#timeout): propagate errors to the caller. [ruby-dev:41010]' Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/lib/timeout.rb branches/ruby_1_8_7/version.h Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 28208) +++ ruby_1_8_7/ChangeLog (revision 28209) @@ -1,3 +1,8 @@ +Tue Jun 8 15:23:10 2010 Nobuyoshi Nakada <nobu@r...> + + * lib/timeout.rb (Timeout#timeout): propagate errors to the + caller. [ruby-dev:41010]' + Tue Jun 8 15:15:18 2010 Nobuyoshi Nakada <nobu@r...> * lib/net/smtp.rb (Net::SMTP#rcptto_list): fixed typo. Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 28208) +++ ruby_1_8_7/version.h (revision 28209) @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2010-06-08" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20100608 -#define RUBY_PATCHLEVEL 273 +#define RUBY_PATCHLEVEL 274 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 Index: ruby_1_8_7/lib/timeout.rb =================================================================== --- ruby_1_8_7/lib/timeout.rb (revision 28208) +++ ruby_1_8_7/lib/timeout.rb (revision 28209) @@ -56,8 +56,13 @@ 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 } yield sec # return true @@ -73,7 +78,10 @@ # would be expected outside. raise Error, e.message, e.backtrace 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/