summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/timeout.rb7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fb7026e155e..21f6c970d60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/lib/timeout.rb b/lib/timeout.rb
index 00e60aff8c3..f5c4e3cbf05 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -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