| 1 |
#include "ruby/ruby.h" |
| 2 |
#include "ruby/io.h" |
| 3 |
|
| 4 |
static VALUE |
| 5 |
io_wait(VALUE klass, VALUE io, VALUE events, VALUE timeout) |
| 6 |
{ |
| 7 |
return rb_io_wait(io, events, timeout); |
| 8 |
} |
| 9 |
|
| 10 |
static VALUE |
| 11 |
io_maybe_wait(VALUE klass, VALUE error, VALUE io, VALUE events, VALUE timeout) |
| 12 |
{ |
| 13 |
return rb_io_maybe_wait(RB_NUM2INT(error), io, events, timeout); |
| 14 |
} |
| 15 |
|
| 16 |
static VALUE |
| 17 |
io_maybe_wait_readable(VALUE klass, VALUE error, VALUE io, VALUE timeout) |
| 18 |
{ |
| 19 |
return RB_INT2NUM( |
| 20 |
rb_io_maybe_wait_readable(RB_NUM2INT(error), io, timeout) |
| 21 |
); |
| 22 |
} |
| 23 |
|
| 24 |
static VALUE |
| 25 |
io_maybe_wait_writable(VALUE klass, VALUE error, VALUE io, VALUE timeout) |
| 26 |
{ |
| 27 |
return RB_INT2NUM( |
| 28 |
rb_io_maybe_wait_writable(RB_NUM2INT(error), io, timeout) |
| 29 |
); |
| 30 |
} |
| 31 |
|
| 32 |
void |
| 33 |
Init_wait(void) |
| 34 |
{ |
| 35 |
rb_define_singleton_method(rb_cIO, "io_wait", io_wait, 3); |
| 36 |
rb_define_singleton_method(rb_cIO, "io_maybe_wait", io_maybe_wait, 4); |
| 37 |
rb_define_singleton_method(rb_cIO, "io_maybe_wait_readable", io_maybe_wait_readable, 3); |
| 38 |
rb_define_singleton_method(rb_cIO, "io_maybe_wait_writable", io_maybe_wait_writable, 3); |
| 39 |
} |