mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/timeout.rb: add optional exception argument for compatibility
function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40f3699376
commit
554f524ee5
2 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Jul 3 23:41:30 2003 Tanaka Akira <akr@m17n.org>
|
||||
|
||||
* lib/timeout.rb: add optional exception argument for compatibility
|
||||
function.
|
||||
|
||||
Thu Jul 3 14:22:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (rb_values_at): extract common procedure from
|
||||
|
|
|
@ -51,8 +51,8 @@ module Timeout
|
|||
end
|
||||
|
||||
# compatible
|
||||
def timeout(n, &block)
|
||||
Timeout::timeout(n, &block)
|
||||
def timeout(n, e=Timeout::Error, &block)
|
||||
Timeout::timeout(n, e, &block)
|
||||
end
|
||||
TimeoutError = Timeout::Error
|
||||
|
||||
|
@ -60,6 +60,9 @@ if __FILE__ == $0
|
|||
p timeout(5) {
|
||||
45
|
||||
}
|
||||
p timeout(5, TimeoutError) {
|
||||
45
|
||||
}
|
||||
p timeout(5) {
|
||||
loop {
|
||||
p 10
|
||||
|
|
Loading…
Reference in a new issue