cUNIXServer
Kgio::UNIXServer should be used in place of the plain UNIXServer when kgio_accept and kgio_tryaccept methods are needed.
Initiates a blocking accept and returns a generic Kgio::Socket object with the kgio_addr attribute set (to the value of Kgio::LOCALHOST) on success.
On Ruby implementations using native threads, this can use a blocking accept(2) (or accept4(2)) system call to avoid thundering herds.
An optional class argument may be specified to override the Kgio::Socket-class return value:
server.kgio_accept(MySocket) -> MySocket
static VALUE unix_accept(int argc, VALUE *argv, VALUE io)
{
VALUE klass = acceptor(argc, argv);
VALUE rv = my_accept(io, klass, NULL, NULL, 0);
rb_ivar_set(rv, iv_kgio_addr, localhost);
return rv;
}
Initiates a non-blocking accept and returns a generic Kgio::Socket object with the kgio_addr attribute set (to the value of Kgio::LOCALHOST) on success.
Returns nil on EAGAIN, and raises on other errors.
An optional class argument may be specified to override the Kgio::Socket-class return value:
server.kgio_tryaccept(MySocket) -> MySocket
static VALUE unix_tryaccept(int argc, VALUE *argv, VALUE io)
{
VALUE klass = acceptor(argc, argv);
VALUE rv = my_accept(io, klass, NULL, NULL, 1);
if (!NIL_P(rv))
rb_ivar_set(rv, iv_kgio_addr, localhost);
return rv;
}
Generated with the Darkfish Rdoc Generator 2.