public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: FIFO: avoid hang after exec
@ 2019-04-18 17:35 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-04-18 17:35 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=230c5df2dfddeb83d31b16f791a079871ba224e8
commit 230c5df2dfddeb83d31b16f791a079871ba224e8
Author: Ken Brown <kbrown@cornell.edu>
Date: Thu Apr 18 15:39:52 2019 +0000
Cygwin: FIFO: avoid hang after exec
Define fhandler:fifo::fixup_after_exec, which sets listen_client_thr
and lct_termination_evt to NULL. This forces the listen_client thread
to restart on the first attempt to read after an exec. Previously the
exec'd process could hang in fhandler_fifo::raw_read.
Diff:
---
winsup/cygwin/fhandler.h | 1 +
winsup/cygwin/fhandler_fifo.cc | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 8fb176b..da007ee 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1301,6 +1301,7 @@ public:
ssize_t __reg3 raw_write (const void *ptr, size_t ulen);
bool arm (HANDLE h);
void fixup_after_fork (HANDLE);
+ void fixup_after_exec ();
int __reg2 fstatvfs (struct statvfs *buf);
void clear_readahead ()
{
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index 1d02adb..bc9c239 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -943,6 +943,15 @@ fhandler_fifo::fixup_after_fork (HANDLE parent)
}
void
+fhandler_fifo::fixup_after_exec ()
+{
+ fhandler_base::fixup_after_exec ();
+ listen_client_thr = NULL;
+ lct_termination_evt = NULL;
+ fifo_client_unlock ();
+}
+
+void
fhandler_fifo::set_close_on_exec (bool val)
{
fhandler_base::set_close_on_exec (val);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-18 17:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18 17:35 [newlib-cygwin] Cygwin: FIFO: avoid hang after exec Corinna Vinschen
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).