/*
* call-seq:
*
* Kgio.accept_nonblock = true
* Kgio.accept_nonblock = false
*
* Sets whether or not Kgio::Socket objects created by
* TCPServer#kgio_accept,
* TCPServer#kgio_tryaccept,
* UNIXServer#kgio_accept,
* and UNIXServer#kgio_tryaccept
* are created with the O_NONBLOCK file status flag.
*
* This defaults to +false+ for GNU/Linux where MSG_DONTWAIT is
* available (and on newer GNU/Linux, accept4() may also set
* the non-blocking flag. This defaults to +true+ on non-GNU/Linux
* systems.
*/
static VALUE set_nonblock(VALUE mod, VALUE boolean)
{
switch (TYPE(boolean)) {
case T_TRUE:
accept4_flags |= SOCK_NONBLOCK;
return boolean;
case T_FALSE:
accept4_flags &= ~SOCK_NONBLOCK;
return boolean;
}
rb_raise(rb_eTypeError, "not true or false");
return Qnil;
}