File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Mon Aug 17 16:51:45 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
2+
3+ * lib/timeout.rb (ExitException): leave Timeout::ExitException as an
4+ alias of Timeout::Error for backward compatibility in stable branch.
5+ [ruby-dev:49179] [Bug #11344]
6+
7+ Mon Aug 17 16:51:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
8+
9+ * lib/timeout.rb (ExitException): removed internal exception class
10+ and use Timeout::Error instead, as using throw/catch to isolate
11+ each timeouts now. [ruby-dev:49179] [Bug #11344]
12+
113Mon Aug 17 16:49:00 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
214
315 * test/net/http/test_httpresponse.rb
Original file line number Diff line number Diff line change 2424module Timeout
2525 # Raised by Timeout#timeout when the block times out.
2626 class Error < RuntimeError
27- end
28- class ExitException < ::Exception # :nodoc:
2927 attr_reader :thread
3028
3129 def self . catch ( *args )
@@ -48,6 +46,7 @@ def exception(*)
4846 self
4947 end
5048 end
49+ ExitException = Error
5150
5251 # :stopdoc:
5352 THIS_FILE = /\A #{ Regexp . quote ( __FILE__ ) } :/o
@@ -103,7 +102,7 @@ def timeout(sec, klass = nil) #:yield: +sec+
103102 bt = e . backtrace
104103 end
105104 else
106- bt = ExitException . catch ( message , &bl )
105+ bt = Error . catch ( message , &bl )
107106 end
108107 rej = /\A #{ Regexp . quote ( __FILE__ ) } :#{ __LINE__ -4 } \z /o
109108 bt . reject! { |m | rej =~ m }
Original file line number Diff line number Diff line change @@ -63,9 +63,9 @@ def initialize(msg) super end
6363 end
6464
6565 def test_exit_exception
66- assert_raise_with_message ( Timeout ::ExitException , "boon" ) do
67- Timeout . timeout ( 10 , Timeout ::ExitException ) do
68- raise Timeout ::ExitException , "boon"
66+ assert_raise_with_message ( Timeout ::Error , "boon" ) do
67+ Timeout . timeout ( 10 , Timeout ::Error ) do
68+ raise Timeout ::Error , "boon"
6969 end
7070 end
7171 end
@@ -80,4 +80,21 @@ def o.each
8080 Timeout . timeout ( 0.01 ) { e . next }
8181 end
8282 end
83+
84+ def test_handle_interrupt
85+ bug11344 = '[ruby-dev:49179] [Bug #11344]'
86+ ok = false
87+ assert_raise ( Timeout ::Error ) {
88+ Thread . handle_interrupt ( Timeout ::Error => :never ) {
89+ Timeout . timeout ( 0.01 ) {
90+ sleep 0.2
91+ ok = true
92+ Thread . handle_interrupt ( Timeout ::Error => :on_blocking ) {
93+ sleep 0.2
94+ }
95+ }
96+ }
97+ }
98+ assert ( ok , bug11344 )
99+ end
83100end
Original file line number Diff line number Diff line change 11#define RUBY_VERSION "2.1.7"
22#define RUBY_RELEASE_DATE "2015-08-17"
3- #define RUBY_PATCHLEVEL 386
3+ #define RUBY_PATCHLEVEL 387
44
55#define RUBY_RELEASE_YEAR 2015
66#define RUBY_RELEASE_MONTH 8
You can’t perform that action at this time.
0 commit comments