about summary refs log tree commit diff
path: root/src/libutil/monitor-fd.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-24T07·52+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-24T07·58+0200
commitaa1560ca079148f5656cbec0d8057d551cb571ff (patch)
tree9d0af861c269d76c47fc8d4bd660e3c1becbb625 /src/libutil/monitor-fd.hh
parent24c6d992c6173507d9fec544ae926c16c201095e (diff)
Fix bogus pass by reference
http://hydra.nixos.org/build/12711659
Diffstat (limited to 'src/libutil/monitor-fd.hh')
-rw-r--r--src/libutil/monitor-fd.hh7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/libutil/monitor-fd.hh b/src/libutil/monitor-fd.hh
index 2cc495cb3ab8..6f7f9792c838 100644
--- a/src/libutil/monitor-fd.hh
+++ b/src/libutil/monitor-fd.hh
@@ -15,23 +15,19 @@ class MonitorFdHup
 {
 private:
     std::thread thread;
-    std::atomic_bool quit;
 
 public:
     MonitorFdHup(int fd)
     {
-        quit = false;
-        thread = std::thread([&]() {
+        thread = std::thread([fd]() {
             /* Wait indefinitely until a POLLHUP occurs. */
             struct pollfd fds[1];
             fds[0].fd = fd;
             fds[0].events = 0;
             if (poll(fds, 1, -1) == -1) {
                 if (errno != EINTR) abort(); // can't happen
-                assert(quit);
                 return; // destructor is asking us to exit
             }
-            fprintf(stderr, "GOT: %d\n", fds[0].revents);
             assert(fds[0].revents & POLLHUP);
             /* We got POLLHUP, so send an INT signal to the main thread. */
             kill(getpid(), SIGINT);
@@ -40,7 +36,6 @@ public:
 
     ~MonitorFdHup()
     {
-        quit = true;
         pthread_kill(thread.native_handle(), SIGINT);
         thread.join();
     }