public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: console: Fix deadlock at calling fork().
@ 2019-08-12 15:14 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-08-12 15:14 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=92e2c1ad9de2d140374bf789b2eb6142b3297120

commit 92e2c1ad9de2d140374bf789b2eb6142b3297120
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Mon Aug 12 22:46:23 2019 +0900

    Cygwin: console: Fix deadlock at calling fork().
    
    - Calling fork() on console occasionally falls into deadlock. The reason
      is not clear, however, this patch fixes this problem anyway.

Diff:
---
 winsup/cygwin/fhandler_console.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index e3656a3..df28c7f 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -168,8 +168,12 @@ fhandler_console::set_unit ()
       if (created)
 	con.owner = getpid ();
     }
-  if (!created && shared_console_info && kill (con.owner, 0) == -1)
-    con.owner = getpid ();
+  if (!created && shared_console_info)
+    {
+      pinfo p (con.owner);
+      if (!p)
+	con.owner = getpid ();
+    }
 
   dev ().parse (devset);
   if (devset != FH_ERROR)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-12 15:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 15:14 [newlib-cygwin] Cygwin: console: Fix deadlock at calling fork() 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).