From f924b52a7779038cee94151f0c1ee144652bccbe Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 1 May 2016 21:08:21 +0200 Subject: Windows: add pthread_sigmask() that does nothing A previous change introduced a call to pthread_sigmask() in order to block SIGPIPE in a thread. Since there are no signal facilities on Windows that are similar to POSIX signals, just ignore the request to block the signal. In the particular case, the effect of blocking SIGPIPE on POSIX is that write() calls return EPIPE when the reader closes the pipe. This is how write() behaves on Windows. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- compat/mingw.h | 1 + compat/win32/pthread.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/compat/mingw.h b/compat/mingw.h index a5fb52f977..c26b6e2958 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -124,6 +124,7 @@ static inline int fcntl(int fd, int cmd, ...) #define sigemptyset(x) (void)0 static inline int sigaddset(sigset_t *set, int signum) { return 0; } +#define SIG_BLOCK 0 #define SIG_UNBLOCK 0 static inline int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) { return 0; } diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h index 8ad187344f..e74157cd4d 100644 --- a/compat/win32/pthread.h +++ b/compat/win32/pthread.h @@ -101,4 +101,9 @@ static inline void *pthread_getspecific(pthread_key_t key) return TlsGetValue(key); } +static inline int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset) +{ + return 0; +} + #endif /* PTHREAD_H */ -- cgit v1.2.3 From ed84387a6bfe271e9c1edd277bb6fad54c6a6f0b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 11 May 2016 17:10:30 +0200 Subject: Windows: only add a no-op pthread_sigmask() when needed In f924b52 (Windows: add pthread_sigmask() that does nothing, 2016-05-01), we introduced a no-op for Windows. However, this breaks building Git in Git for Windows' SDK because pthread_sigmask() is already a no-op there, #define'd in the pthread_signal.h header in /mingw64/x86_64-w64-mingw32/include/. Let's wrap the definition of pthread_sigmask() in a guard that skips it when compiling with MinGW-w64' headers. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- compat/win32/pthread.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h index e74157cd4d..7eac560d85 100644 --- a/compat/win32/pthread.h +++ b/compat/win32/pthread.h @@ -101,9 +101,11 @@ static inline void *pthread_getspecific(pthread_key_t key) return TlsGetValue(key); } +#ifndef __MINGW64_VERSION_MAJOR static inline int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset) { return 0; } +#endif #endif /* PTHREAD_H */ -- cgit v1.2.3