ruby-changes:15002
From: nobu <ko1@a...>
Date: Fri, 12 Mar 2010 06:37:39 +0900 (JST)
Subject: [ruby-changes:15002] Ruby:r26877 (trunk): * sample/timeout.rb: split from lib/timeout.rb.
nobu 2010-03-12 06:37:16 +0900 (Fri, 12 Mar 2010) New Revision: 26877 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26877 Log: * sample/timeout.rb: split from lib/timeout.rb. Added files: trunk/sample/timeout.rb Modified files: trunk/ChangeLog trunk/lib/timeout.rb trunk/version.h Index: ChangeLog =================================================================== --- ChangeLog (revision 26876) +++ ChangeLog (revision 26877) @@ -1,3 +1,7 @@ +Fri Mar 12 06:37:13 2010 Nobuyoshi Nakada <nobu@r...> + + * sample/timeout.rb: split from lib/timeout.rb. + Thu Mar 11 22:35:27 2010 Tanaka Akira <akr@f...> * time.c (time_round): new method Time#round. [ruby-dev:40595] Index: sample/timeout.rb =================================================================== --- sample/timeout.rb (revision 0) +++ sample/timeout.rb (revision 26877) @@ -0,0 +1,42 @@ +require 'timeout' + +def progress(n = 5) + n.times {|i| print i; STDOUT.flush; sleep 1; i+= 1} + puts "never reach" +end + +p timeout(5) { + 45 +} +p timeout(5, TimeoutError) { + 45 +} +p timeout(nil) { + 54 +} +p timeout(0) { + 54 +} +begin + timeout(5) {progress} +rescue => e + puts e.message +end +begin + timeout(3) { + begin + timeout(5) {progress} + rescue => e + puts "never reach" + end + } +rescue => e + puts e.message +end +class MyTimeout < StandardError +end +begin + timeout(2, MyTimeout) {progress} +rescue MyTimeout => e + puts e.message +end Property changes on: sample/timeout.rb ___________________________________________________________________ Name: svn:eol-style + LF Index: lib/timeout.rb =================================================================== --- lib/timeout.rb (revision 26876) +++ lib/timeout.rb (revision 26877) @@ -85,24 +85,3 @@ # Another name for Timeout::Error, defined for backwards compatibility with # earlier versions of timeout.rb. TimeoutError = Timeout::Error - -if __FILE__ == $0 - p timeout(5) { - 45 - } - p timeout(5, TimeoutError) { - 45 - } - p timeout(nil) { - 54 - } - p timeout(0) { - 54 - } - p timeout(5) { - loop { - p 10 - sleep 1 - } - } -end Index: version.h =================================================================== --- version.h (revision 26876) +++ version.h (revision 26877) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_RELEASE_DATE "2010-03-11" +#define RUBY_RELEASE_DATE "2010-03-12" #define RUBY_PATCHLEVEL -1 #define RUBY_BRANCH_NAME "trunk" @@ -8,7 +8,7 @@ #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_YEAR 2010 #define RUBY_RELEASE_MONTH 3 -#define RUBY_RELEASE_DAY 11 +#define RUBY_RELEASE_DAY 12 #include "ruby/version.h" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/