git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* pthread_sigmask() on windows (wine actualy)
@ 2016-05-01 11:06 Duy Nguyen
  2016-05-01 17:45 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Duy Nguyen @ 2016-05-01 11:06 UTC (permalink / raw)
  To: Jeff King; +Cc: git-for-windows, Git Mailing List

I got this while compiling master today using mingw32 cross toolchain

    CC run-command.o
run-command.c: In function 'run_thread':
run-command.c:596:3: warning: implicit declaration of function
'pthread_sigmask' [-Wimplicit-function-declaration]
run-command.c:596:23: error: 'SIG_BLOCK' undeclared (first use in this function)
run-command.c:596:23: note: each undeclared identifier is reported
only once for each function it appears in

This is added in c792d7b (run-command: teach async threads to ignore
SIGPIPE - 2016-04-19). From the look of it, wrapping #ifndef
GIT_WINDOWS_NATIVE is probably enough? I checked gfw/master too to see
how gfw deals with it, but the commit has not been merged there yet.
-- 
Duy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pthread_sigmask() on windows (wine actualy)
  2016-05-01 11:06 pthread_sigmask() on windows (wine actualy) Duy Nguyen
@ 2016-05-01 17:45 ` Jeff King
  2016-05-01 19:08   ` [PATCH jk/push-client-deadlock-fix] Windows: add pthread_sigmask() that does nothing Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2016-05-01 17:45 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Johannes Sixt, git-for-windows, Git Mailing List

On Sun, May 01, 2016 at 06:06:07PM +0700, Duy Nguyen wrote:

> I got this while compiling master today using mingw32 cross toolchain
> 
>     CC run-command.o
> run-command.c: In function 'run_thread':
> run-command.c:596:3: warning: implicit declaration of function
> 'pthread_sigmask' [-Wimplicit-function-declaration]
> run-command.c:596:23: error: 'SIG_BLOCK' undeclared (first use in this function)
> run-command.c:596:23: note: each undeclared identifier is reported
> only once for each function it appears in
> 
> This is added in c792d7b (run-command: teach async threads to ignore
> SIGPIPE - 2016-04-19). From the look of it, wrapping #ifndef
> GIT_WINDOWS_NATIVE is probably enough? I checked gfw/master too to see
> how gfw deals with it, but the commit has not been merged there yet.

I think the fix should go into compat/. See

  http://git.661346.n2.nabble.com/PATCH-0-5-fix-deadlock-in-git-push-tp7653666p7653818.html

(sorry, gmane seems down).

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH jk/push-client-deadlock-fix] Windows: add pthread_sigmask() that does nothing
  2016-05-01 17:45 ` Jeff King
@ 2016-05-01 19:08   ` Johannes Sixt
  2016-05-03  4:48     ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Sixt @ 2016-05-01 19:08 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Jeff King, git-for-windows, Git Mailing List

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 <j6t@kdbg.org>
---
 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 a950ae2..0f272fd 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -142,6 +142,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 b6ed9e7..d336451 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -104,4 +104,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 */
-- 
2.7.0.118.g90056ae

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH jk/push-client-deadlock-fix] Windows: add pthread_sigmask() that does nothing
  2016-05-01 19:08   ` [PATCH jk/push-client-deadlock-fix] Windows: add pthread_sigmask() that does nothing Johannes Sixt
@ 2016-05-03  4:48     ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2016-05-03  4:48 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Duy Nguyen, git-for-windows, Git Mailing List

On Sun, May 01, 2016 at 09:08:21PM +0200, Johannes Sixt wrote:

> 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 <j6t@kdbg.org>
> ---

Looks good to me based on our earlier discussion (but of course I have
no platform to test it on).

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-03  4:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-01 11:06 pthread_sigmask() on windows (wine actualy) Duy Nguyen
2016-05-01 17:45 ` Jeff King
2016-05-01 19:08   ` [PATCH jk/push-client-deadlock-fix] Windows: add pthread_sigmask() that does nothing Johannes Sixt
2016-05-03  4:48     ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).