mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
MonitorFdHup
: introduce a num_fds
variable
Better than just putting `1` in multiple spots.
This commit is contained in:
parent
d028bb4c4a
commit
cb95791198
1 changed files with 3 additions and 2 deletions
|
@ -25,7 +25,8 @@ public:
|
|||
thread = std::thread([fd]() {
|
||||
while (true) {
|
||||
/* Wait indefinitely until a POLLHUP occurs. */
|
||||
struct pollfd fds[1] = {
|
||||
constexpr size_t num_fds = 1;
|
||||
struct pollfd fds[num_fds] = {
|
||||
{
|
||||
.fd = fd,
|
||||
.events =
|
||||
|
@ -41,7 +42,7 @@ public:
|
|||
},
|
||||
};
|
||||
|
||||
auto count = poll(fds, 1, -1);
|
||||
auto count = poll(fds, num_fds, -1);
|
||||
if (count == -1) {
|
||||
if (errno == EINTR || errno == EAGAIN)
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue