[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();
}
};
- 99/376: install-nix-from-closure.sh: Install cacert, (continued)
- 99/376: install-nix-from-closure.sh: Install cacert, Ludovic Courtès, 2015/01/28
- 93/376: nix-copy-closure: Implement --gzip via ssh's -C flag, Ludovic Courtès, 2015/01/28
- 91/376: Remove obsolete SSH master connection code, Ludovic Courtès, 2015/01/28
- 100/376: Rename nixPath to __nixPath, Ludovic Courtès, 2015/01/28
- 95/376: Change the default for use-ssh-substituter to ‘true’, Ludovic Courtès, 2015/01/28
- 90/376: Implement nix-copy-closure --from via nix-store --serve, Ludovic Courtès, 2015/01/28
- 97/376: Remove outdated AUTHORS file, Ludovic Courtès, 2015/01/28
- 92/376: Fix NIX_SSHOPTS, Ludovic Courtès, 2015/01/28
- 103/376: Allow regular files as GC roots, Ludovic Courtès, 2015/01/28
- 94/376: nix-copy-closure: Drop --bzip2, --xz, --show-progress, Ludovic Courtès, 2015/01/28
- 84/376: Use pthread_cancel instead of a signal,
Ludovic Courtès <=
- 102/376: Restore default SIGPIPE handler before invoking ‘man’, Ludovic Courtès, 2015/01/28
- 98/376: nix-profile.sh: Set $SSL_CERT_FILE, Ludovic Courtès, 2015/01/28
- 96/376: nix-daemon: Pass on the user's $SSH_AUTH_SOCK to the SSH substituter, Ludovic Courtès, 2015/01/28
- 101/376: make clean: Remove Makefile.config, Ludovic Courtès, 2015/01/28
- 105/376: findRoots(): Prevent a call to lstat(), Ludovic Courtès, 2015/01/28
- 108/376: Remove ugly hack for detecting build environment setup errors, Ludovic Courtès, 2015/01/28
- 107/376: Call commonChildInit() before doing chroot init, Ludovic Courtès, 2015/01/28
- 104/376: Make readDirectory() return inode / file type, Ludovic Courtès, 2015/01/28
- 106/376: Eliminate redundant copy, Ludovic Courtès, 2015/01/28
- 110/376: Make chroot builds easier to set up, Ludovic Courtès, 2015/01/28