socket :: NativeSocketSet :: defaultinit
# Structure used to register FDs for a Select
#
# FIXME: This should not be Socket-specific
# FIXME: This is Unix-specific
extern class NativeSocketSet `{ fd_set* `}
new `{
fd_set *f = NULL;
f = malloc(sizeof(fd_set));
return f;
`}
# Add a file descriptor to the set
fun set(s: NativeSocket) `{ FD_SET(*s, self); `}
# Check if `s` is in the set
fun is_set(s: NativeSocket): Bool `{ return FD_ISSET(*s, self); `}
# Clear the set
fun zero `{ FD_ZERO(self); `}
# Remove `s` from the set
fun clear(s: NativeSocket) `{ FD_CLR(*s, self); `}
# Free the set
fun destroy `{ free(self); `}
end
lib/socket/socket_c.nit:369,1--394,3