public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pty: Add missing guard for close_pseudoconsole().
@ 2021-04-21  3:07 Takashi Yano
  0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2021-04-21  3:07 UTC (permalink / raw)
  To: cygwin-patches

- This patch adds a missing mutex guard for close_pseudoconsole()
  call when GDB exits.
---
 winsup/cygwin/fhandler_tty.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 530321513..9c03e09a7 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -177,7 +177,9 @@ atexit_func (void)
 						    input_available_event);
 		ReleaseMutex (ptys->input_mutex);
 	      }
+	    WaitForSingleObject (ptys->pcon_mutex, INFINITE);
 	    ptys->close_pseudoconsole (ttyp, force_switch_to);
+	    ReleaseMutex (ptys->pcon_mutex);
 	    break;
 	  }
       CloseHandle (h_gdb_process);
-- 
2.31.1


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

only message in thread, other threads:[~2021-04-21  3:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21  3:07 [PATCH] Cygwin: pty: Add missing guard for close_pseudoconsole() Takashi Yano

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).