]> sourceware.org Git - newlib-cygwin.git/commitdiff
* tty.cc (tty_list::allocate_tty): Leave tty_mutex armed on successful return
authorChristopher Faylor <me@cgf.cx>
Thu, 20 May 2004 17:32:12 +0000 (17:32 +0000)
committerChristopher Faylor <me@cgf.cx>
Thu, 20 May 2004 17:32:12 +0000 (17:32 +0000)
from !with_console
* fhandler_tty.cc (fhandler_pty_master::open): Release tty_mutex here after all
initialization is done.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_tty.cc
winsup/cygwin/tty.cc

index 8fae3f8e6492ce63915d6e379b7c9eca3f291b31..8a763f9bc0ff35ae055711d966422612ff1eb8d3 100644 (file)
@@ -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
index 8b98c2dbaae5a0dcef1fd3f0612203a786a1c4e5..bf17e833128493d56607ee58e32084e317309656 100644 (file)
@@ -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 ();
index fd8132c3a118e7bca0d88f3ce20bf3495c912a07..e374acb7c11c664602ef86c1b48004fc49d34dde 100644 (file)
@@ -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;
 }
 
This page took 0.036905 seconds and 5 git commands to generate.