public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: FIFO: start the listen_client thread when duping a reader
@ 2019-04-16 11:16 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-04-16 11:16 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a7d08b3ecd721e98757f8f96945660809ec6a3da
commit a7d08b3ecd721e98757f8f96945660809ec6a3da
Author: Ken Brown <kbrown@cornell.edu>
Date: Sun Apr 14 19:16:03 2019 +0000
Cygwin: FIFO: start the listen_client thread when duping a reader
Otherwise it doesn't get started until the dup'd fd tries to read,
which delays client connections.
Diff:
---
winsup/cygwin/fhandler_fifo.cc | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index a3ecbeb..fe4c67b 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -853,19 +853,20 @@ fhandler_fifo::close ()
int
fhandler_fifo::dup (fhandler_base *child, int flags)
{
+ int ret = -1;
+ fhandler_fifo *fhf = NULL;
+
if (fhandler_base::dup (child, flags))
- {
- __seterrno ();
- return -1;
- }
- fhandler_fifo *fhf = (fhandler_fifo *) child;
+ goto out;
+
+ fhf = (fhandler_fifo *) child;
if (!DuplicateHandle (GetCurrentProcess (), read_ready,
GetCurrentProcess (), &fhf->read_ready,
0, true, DUPLICATE_SAME_ACCESS))
{
fhf->close ();
__seterrno ();
- return -1;
+ goto out;
}
if (!DuplicateHandle (GetCurrentProcess (), write_ready,
GetCurrentProcess (), &fhf->write_ready,
@@ -874,7 +875,7 @@ fhandler_fifo::dup (fhandler_base *child, int flags)
CloseHandle (fhf->read_ready);
fhf->close ();
__seterrno ();
- return -1;
+ goto out;
}
for (int i = 0; i < nhandlers; i++)
{
@@ -895,13 +896,16 @@ fhandler_fifo::dup (fhandler_base *child, int flags)
CloseHandle (fhf->write_ready);
fhf->close ();
__seterrno ();
- return -1;
+ goto out;
}
}
fhf->listen_client_thr = NULL;
fhf->lct_termination_evt = NULL;
fhf->fifo_client_unlock ();
- return 0;
+ if (!reader || fhf->listen_client ())
+ ret = 0;
+out:
+ return ret;
}
void
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-16 11:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 11:16 [newlib-cygwin] Cygwin: FIFO: start the listen_client thread when duping a reader 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).