diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-29 18:26:55 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-29 18:26:55 +0000 |
commit | 24424d3991179ec50837cff97b21f646f7069447 (patch) | |
tree | 5f73958731220fb1eaba3f52421a97d0bb88ce42 /lib | |
parent | 2579aad6fa276f46cd2841a4a735bebc164c62c0 (diff) | |
download | ruby-24424d3991179ec50837cff97b21f646f7069447.tar.gz ruby-24424d3991179ec50837cff97b21f646f7069447.tar.xz ruby-24424d3991179ec50837cff97b21f646f7069447.zip |
* marshal.c (w_object): if object responds to 'marshal_dump',
Marshal.dump uses it to dump object. unlike '_dump',
marshal_dump returns any kind of object.
* marshal.c (r_object0): restore instance by calling
'marshal_load' method. unlike '_load', it's an instance
method, to handle cyclic reference.
* marshal.c (marshal_load): all objects read from file should be
tainted. [ruby-core:01325]
* lib/timeout.rb (Timeout::timeout): execute immediately if sec is
zero.
* ext/socket/socket.c (socks_init): typo fixed. [ruby-talk:77232]
* ext/socket/extconf.rb: the default value for --enable-socks is
taken from ENV["SOCKS_SERVER"]. [ruby-talk:77232]
* ruby.c (proc_options): add -W option. -W0 to shut up all warning
messages. [ruby-talk:77227]
* error.c (rb_warn): no message will be printed if the value of
$VERBOSE is "nil", i.e. perfect silence.
* ruby.c (verbose_setter): $VERBOSE value is either true, false,
or nil.
* io.c (Init_IO): no "read" check for $stdin. in addition some
function names has been changed.
* regex.c (re_match_exec): incorrect multibyte match.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/timeout.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb index f5c4e3cbf..5c6a72652 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -34,7 +34,7 @@ module Timeout end def timeout(sec, exception=Error) - return yield if sec == nil + return yield if sec == nil or sec.zero? begin x = Thread.current y = Thread.start { @@ -63,6 +63,12 @@ if __FILE__ == $0 p timeout(5, TimeoutError) { 45 } + p timeout(nil) { + 54 + } + p timeout(0) { + 54 + } p timeout(5) { loop { p 10 |