0 on success, or -1 with errno set on failure.
Example:
auto handle = Handle(STDIN_FILENO);
if (setNonBlocking(handle) != 0) {
// Handle error
}
loop.registerIo(handle, IoInterest.readable, &onReadable);Set a file descriptor to non-blocking mode.
This helper sets the O_NONBLOCK flag on a file descriptor, which is required for proper event loop integration. User-provided handles registered with registerIo() should be set to non-blocking mode to prevent the event loop from stalling on blocking reads/writes.
handle | Handle to set to non-blocking mode. |
0 on success, or -1 with errno set on failure.
Example:
auto handle = Handle(STDIN_FILENO);
if (setNonBlocking(handle) != 0) {
// Handle error
}
loop.registerIo(handle, IoInterest.readable, &onReadable);