diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
commit | a1b4816759418ca8fe510e8739622fc5d77ab0f0 (patch) | |
tree | 9d4fb6091d0086817f5bde46bf1150e9130d34fd /spec/ruby/optional/capi/io_spec.rb | |
parent | 00c33d9c232ed1a79eda17acd7231ac93caa162b (diff) | |
download | ruby-a1b4816759418ca8fe510e8739622fc5d77ab0f0.tar.gz |
Update to ruby/spec@15c9619
Diffstat (limited to 'spec/ruby/optional/capi/io_spec.rb')
-rw-r--r-- | spec/ruby/optional/capi/io_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/io_spec.rb b/spec/ruby/optional/capi/io_spec.rb index a832c6a93b..82dc1fc0df 100644 --- a/spec/ruby/optional/capi/io_spec.rb +++ b/spec/ruby/optional/capi/io_spec.rb @@ -299,6 +299,26 @@ describe "C-API IO function" do end end + describe "rb_wait_for_single_fd" do + it "waits til an fd is ready for reading" do + start = false + thr = Thread.new do + start = true + sleep 0.05 + @w_io.write "rb_io_wait_readable" + end + + Thread.pass until start + + @o.rb_wait_for_single_fd(@r_io, 1, nil, nil).should == 1 + + thr.join + end + + it "polls whether an fd is ready for reading if timeout is 0" do + @o.rb_wait_for_single_fd(@r_io, 1, 0, 0).should == 0 + end + end end describe "rb_fd_fix_cloexec" do |