Feature #16597 » 0008-test-fix-up-wait_for_single_fd-to-accept-RB_WAITFD_E.patch
ext/-test-/wait_for_single_fd/wait_for_single_fd.c | ||
---|---|---|
rb_define_const(rb_cObject, "RB_WAITFD_IN", INT2NUM(RB_WAITFD_IN));
|
||
rb_define_const(rb_cObject, "RB_WAITFD_OUT", INT2NUM(RB_WAITFD_OUT));
|
||
rb_define_const(rb_cObject, "RB_WAITFD_PRI", INT2NUM(RB_WAITFD_PRI));
|
||
rb_define_const(rb_cObject, "RB_WAITFD_ERR", INT2NUM(RB_WAITFD_ERR));
|
||
rb_define_singleton_method(rb_cIO, "wait_for_single_fd",
|
||
wait_for_single_fd, 3);
|
||
#ifdef HAVE_KQUEUE
|
test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb | ||
---|---|---|
IO.pipe do |r,w|
|
||
w.close
|
||
rc = IO.wait_for_single_fd(r.fileno, RB_WAITFD_IN, nil)
|
||
assert_equal RB_WAITFD_IN, rc
|
||
if IO.methods.include? :select_with_poll then
|
||
assert_equal RB_WAITFD_IN|RB_WAITFD_ERR, rc
|
||
else
|
||
assert_equal RB_WAITFD_IN, rc
|
||
end
|
||
end
|
||
end
|
||