aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-05-20 17:32:12 +0000
committerChristopher Faylor <me@cgf.cx>2004-05-20 17:32:12 +0000
commitbfa768973cc0b0d0cdc74ccb09b494e24016a4a1 (patch)
tree9a61887b62b85d04d31dc1a1d5a59aa5871daaf2
parente5a32b9a9639a1b3e203a27a0681a3a8ab07e5d6 (diff)
downloadnewlib-bfa768973cc0b0d0cdc74ccb09b494e24016a4a1.zip
newlib-bfa768973cc0b0d0cdc74ccb09b494e24016a4a1.tar.gz
newlib-bfa768973cc0b0d0cdc74ccb09b494e24016a4a1.tar.bz2
* tty.cc (tty_list::allocate_tty): Leave tty_mutex armed on successful return
from !with_console * fhandler_tty.cc (fhandler_pty_master::open): Release tty_mutex here after all initialization is done.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler_tty.cc1
-rw-r--r--winsup/cygwin/tty.cc12
3 files changed, 17 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 8fae3f8..8a763f9 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-20 Christopher Faylor <cgf@alum.bu.edu>
+
+ * tty.cc (tty_list::allocate_tty): Leave tty_mutex armed on successful
+ return from !with_console
+ * fhandler_tty.cc (fhandler_pty_master::open): Release tty_mutex here
+ after all initialization is done.
+
2004-05-17 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (getgrgid_r): Replace struct group by struct __group32 in
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 8b98c2d..bf17e83 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1164,6 +1164,7 @@ fhandler_pty_master::open (int flags, mode_t)
slave = *ttys_dev;
slave.setunit (ntty);
cygwin_shared->tty[ntty]->common_init (this);
+ ReleaseMutex (tty_mutex); // lock was set in allocate_tty
inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE);
set_flags ((flags & ~O_TEXT) | O_BINARY);
set_open_status ();
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index fd8132c..e374acb 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -282,16 +282,22 @@ tty_list::allocate_tty (bool with_console)
out:
if (freetty < 0)
- system_printf ("No tty allocated");
+ {
+ ReleaseMutex (tty_mutex);
+ system_printf ("No tty allocated");
+ }
else if (!with_console)
- termios_printf ("tty%d allocated", freetty);
+ {
+ termios_printf ("tty%d allocated", freetty);
+ /* exit with tty_mutex still held -- caller has more work to do */
+ }
else
{
termios_printf ("console %p associated with tty%d", console, freetty);
if (!hmaster)
create_tty_master (freetty);
+ ReleaseMutex (tty_mutex);
}
- ReleaseMutex (tty_mutex);
return freetty;
}