wait readable/writable

* ext/io/wait/wait.c (io_wait_readwrite): [EXPERIMENTAL] allow to
  wait for multiple modes, readable and writable, at once.  the
  arguments may change in the future.  [Feature #12013]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-01-24 07:55:05 +00:00
parent 57752a2503
commit b58fac9a97
3 changed files with 92 additions and 3 deletions

View file

@ -134,6 +134,18 @@ class TestIOWait < Test::Unit::TestCase
assert_raise(IOError) { @w.wait_writable }
end
def test_wait_readwrite
assert_equal @r.wait(0, :write), @r.wait(0, :read_write)
end
def test_wait_readwrite_timeout
assert_equal @w, @w.wait(0.01, :read_write)
written = fill_pipe
assert_nil @w.wait(0.01, :read_write)
@r.read(written)
assert_equal @w, @w.wait(0.01, :read_write)
end
private
def fill_pipe