mirror of
https://github.com/NixOS/nix
synced 2025-06-25 19:01: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]() {
|
thread = std::thread([fd]() {
|
||||||
while (true) {
|
while (true) {
|
||||||
/* Wait indefinitely until a POLLHUP occurs. */
|
/* Wait indefinitely until a POLLHUP occurs. */
|
||||||
struct pollfd fds[1] = {
|
constexpr size_t num_fds = 1;
|
||||||
|
struct pollfd fds[num_fds] = {
|
||||||
{
|
{
|
||||||
.fd = fd,
|
.fd = fd,
|
||||||
.events =
|
.events =
|
||||||
|
@ -41,7 +42,7 @@ public:
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
auto count = poll(fds, 1, -1);
|
auto count = poll(fds, num_fds, -1);
|
||||||
if (count == -1) {
|
if (count == -1) {
|
||||||
if (errno == EINTR || errno == EAGAIN)
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue