addFd

fnvoid addFd(int fd, FdEvent events, FdHandler handler) nothrow @nogc

Adds a file descriptor callback.

The callback will be invoked when the specified events occur on the file descriptor.

Parameters

fdFile descriptor to monitor
eventsEvents to monitor (FdEvent flags)
handlerCallback delegate Example:
import core.sys.posix.unistd : pipe;
int[2] fds;
pipe(fds);
addFd(fds[0], FdEvent.read, (fd) nothrow @nogc {
   // Data available to read
});
fnvoid addFd(int fd, FdHandler handler) nothrow @nogc

Adds a file descriptor callback for read events.

Convenience function equivalent to addFd(fd, FdEvent.read, handler).

Parameters

fdFile descriptor to monitor
handlerCallback delegate