diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-12 11:51:11 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-12 11:51:11 +0000 |
commit | bb4dcd5582eafa8947c1520cc187c64e302755a2 (patch) | |
tree | ab06e8932e27ae38ddbbe161c62f97e945e98303 | |
parent | 167f6b291f4cf697048af42820c82d8cf357e0a7 (diff) |
* Backport r33231.
* thread.c (rb_thread_select): fix a typo to initialize efds
properly. [Bug #5299] [ruby-core:39380]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/-ext-/old_thread_select/test_old_thread_select.rb | 15 | ||||
-rw-r--r-- | thread.c | 2 |
3 files changed, 19 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Mon Sep 12 20:47:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * thread.c (rb_thread_select): fix a typo to initialize efds + properly. [Bug #5299] [ruby-core:39380] + Mon Sep 12 20:41:20 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> * thread.c (rb_thread_select): fix to ignore an argument diff --git a/test/-ext-/old_thread_select/test_old_thread_select.rb b/test/-ext-/old_thread_select/test_old_thread_select.rb index 18235b845a..1ccdb3414d 100644 --- a/test/-ext-/old_thread_select/test_old_thread_select.rb +++ b/test/-ext-/old_thread_select/test_old_thread_select.rb @@ -23,6 +23,17 @@ class TestOldThreadSelect < Test::Unit::TestCase end end + def test_old_select_error_timeout + bug5299 = '[ruby-core:39380]' + with_pipe do |r, w| + t0 = Time.now + rc = IO.old_thread_select(nil, nil, [r.fileno], 0.001) + diff = Time.now - t0 + assert_equal 0, rc, bug5299 + assert_operator diff, :>=, 0.001, "returned too early" + end + end + def test_old_select_false_positive bug5306 = '[ruby-core:39435]' with_pipe do |r2, w2| @@ -77,7 +88,7 @@ class TestOldThreadSelect < Test::Unit::TestCase assert_equal 0, rc assert_equal true, thr.value assert received, "SIGINT not received" - ensure - trap(:INT, "DEFAULT") + ensure + trap(:INT, "DEFAULT") end end @@ -2726,7 +2726,7 @@ rb_thread_select(int max, fd_set * read, fd_set * write, fd_set * except, } if (except) { efds = &fdsets[2]; - rb_fd_init(wfds); + rb_fd_init(efds); rb_fd_copy(efds, except, max); } |