1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

MonitorFdHup: Cleanup a bit with designated initializers

This commit is contained in:
John Ericson 2025-03-23 17:58:50 -04:00
parent 8e0bc2c3a8
commit d028bb4c4a

View file

@ -25,19 +25,22 @@ public:
thread = std::thread([fd]() {
while (true) {
/* Wait indefinitely until a POLLHUP occurs. */
struct pollfd fds[1];
fds[0].fd = fd;
struct pollfd fds[1] = {
{
.fd = fd,
.events =
/* Polling for no specific events (i.e. just waiting
for an error/hangup) doesn't work on macOS
anymore. So wait for read events and ignore
them. */
fds[0].events =
#ifdef __APPLE__
POLLRDNORM
POLLRDNORM,
#else
0
0,
#endif
;
},
};
auto count = poll(fds, 1, -1);
if (count == -1) {
if (errno == EINTR || errno == EAGAIN)