* lib/timeout.rb (Timeout#timeout): specify a exception
more strictly at async_interrupt_timing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
61f46bafa4
commit
ce48e9a930
@ -1,3 +1,8 @@
|
|||||||
|
Thu Dec 6 00:51:21 2012 Masaya Tarui <tarui@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/timeout.rb (Timeout#timeout): specify a exception
|
||||||
|
more strictly at async_interrupt_timing.
|
||||||
|
|
||||||
Wed Dec 5 04:50:17 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Wed Dec 5 04:50:17 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* lib/timeout.rb (Timeout#timeout): set
|
* lib/timeout.rb (Timeout#timeout): set
|
||||||
|
@ -49,8 +49,8 @@ module Timeout
|
|||||||
# a module method, so you can call it directly as Timeout.timeout().
|
# a module method, so you can call it directly as Timeout.timeout().
|
||||||
def timeout(sec, klass = nil, immediate: false) #:yield: +sec+
|
def timeout(sec, klass = nil, immediate: false) #:yield: +sec+
|
||||||
return yield(sec) if sec == nil or sec.zero?
|
return yield(sec) if sec == nil or sec.zero?
|
||||||
Thread.async_interrupt_timing(klass ? klass : ExitException => immediate ? :immediate : :on_blocking) do
|
|
||||||
exception = klass || Class.new(ExitException)
|
exception = klass || Class.new(ExitException)
|
||||||
|
Thread.async_interrupt_timing(exception => immediate ? :immediate : :on_blocking) do
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
x = Thread.current
|
x = Thread.current
|
||||||
|
Loading…
x
Reference in New Issue
Block a user