I hit this while trying to debug lldb-server. When lldb-server is waiting for connections, it will be in MainLoop::RunImpl::Poll(), in the kevent() call. On darwin systems, attaching to the process (or interrupting it to add a breakpoint or detach) will interrupt the system call it is sitting in. We will get back an error return value (-1) and errno will be set to EINTR.
Currently we flag this as an error and lldb-server exits with
error: IO object is not valid.
which makes it a bit difficult to debug.
This section of code is only used on the *BSD systems and Darwin (it's #ifdef'ed HAVE_SYS_EVENT_H). I tested it on Darwin and on Linux (before noticing that linux doesn't have sys/event.h) but don't have access to a *BSD system. I don't expect any problems handling the interrupted kevent() call on those systems as I'm doing here.
There's an llvm::sys::RetryAfterSignal which implements the EINTR loop. I had to pass out_events as &out_events[0] to make template deduction happy.