guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

84/376: Use pthread_cancel instead of a signal


From: Ludovic Courtès
Subject: 84/376: Use pthread_cancel instead of a signal
Date: Wed, 28 Jan 2015 22:04:12 +0000

civodul pushed a commit to tag 1.8
in repository guix.

commit 0fae20c36226c8596dd9676c354ca957808ea3d1
Author: Eelco Dolstra <address@hidden>
Date:   Thu Jul 24 11:47:51 2014 +0200

    Use pthread_cancel instead of a signal
    
    Signal handlers are process-wide, so sending SIGINT to the monitor
    thread will cause the normal SIGINT handler to run. This sets the
    isInterrupted flag, which is not what we want. So use pthread_cancel
    instead.
---
 src/libutil/monitor-fd.hh |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/libutil/monitor-fd.hh b/src/libutil/monitor-fd.hh
index 6f7f979..72d23fb 100644
--- a/src/libutil/monitor-fd.hh
+++ b/src/libutil/monitor-fd.hh
@@ -24,10 +24,7 @@ public:
             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
-                return; // destructor is asking us to exit
-            }
+            if (poll(fds, 1, -1) == -1) abort(); // can't happen
             assert(fds[0].revents & POLLHUP);
             /* We got POLLHUP, so send an INT signal to the main thread. */
             kill(getpid(), SIGINT);
@@ -36,7 +33,7 @@ public:
 
     ~MonitorFdHup()
     {
-        pthread_kill(thread.native_handle(), SIGINT);
+        pthread_cancel(thread.native_handle());
         thread.join();
     }
 };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]