/*
* call-seq:
* mq.to_io => IO
*
* Returns an IO.select-able +IO+ object. This method is only available
* under Linux and FreeBSD and is not intended to be portable.
*/
static VALUE to_io(VALUE self)
{
struct posix_mq *mq = get(self, 1);
int fd = MQD_TO_FD(mq->des);
if (NIL_P(mq->io)) {
mq->io = rb_funcall(rb_cIO, id_new, 1, INT2NUM(fd));
if (!mq->autoclose)
rb_funcall(mq->io, id_setautoclose, 1, Qfalse);
}
return mq->io;
}