[PATCH] Cygwin: pty: Add missing guard for close_pseudoconsole().

Takashi Yano takashi.yano@nifty.ne.jp
Wed Apr 21 03:07:31 GMT 2021


- 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



More information about the Cygwin-patches mailing list