Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Duda <deo@logos-m.ru>2001-03-19 21:27:37 +0300
committerEgor Duda <deo@logos-m.ru>2001-03-19 21:27:37 +0300
commit78ace8a7e5103099f20423acbc6d03c1b5d53fdd (patch)
tree4601ec6f506485c5701fa607919575a527ed1823 /winsup/cygwin/fhandler_tty.cc
parent98750a84047ec2ab23c3c74006e29319ce66e595 (diff)
* tty.h (tty::create_inuse): Add new parameter to allow non-
inheritable 'inuse' events. * tty.cc (tty::create_inuse): Use new parameter. * fhandler_tty.cc (fhandler_tty_master::init): Ditto. * fhandler_tty.cc (fhandler_pty_master::open): Ditto. * fhandler_tty.cc (fhandler_tty_master::init): Create master_alive event. * tty.cc (tty_list::terminate): Close master_alive event. * fhandler_tty.cc (fhandler_tty_common::close): Send EOF to slaves when master side is closed.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index a2e815e66..7f140a5c3 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -61,6 +61,8 @@ fhandler_tty_master::init (int ntty)
cygwin_shared->tty[ttynum]->common_init (this);
+ inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE, FALSE);
+
h = makethread (process_input, NULL, 0, "ttyin");
if (h == NULL)
{
@@ -482,7 +484,7 @@ fhandler_tty_slave::open (const char *, int flags, mode_t)
/* FIXME: Needs a method to eliminate tty races */
{
acquire_output_mutex (500);
- inuse = get_ttyp ()->create_inuse (TTY_SLAVE_ALIVE);
+ inuse = get_ttyp ()->create_inuse (TTY_SLAVE_ALIVE, TRUE);
get_ttyp ()->was_opened = TRUE;
release_output_mutex ();
}
@@ -947,7 +949,7 @@ fhandler_pty_master::open (const char *, int flags, mode_t)
return 0;
cygwin_shared->tty[ttynum]->common_init (this);
- inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE);
+ inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE, FALSE);
set_flags (flags);
termios_printf ("opened pty master tty%d<%p>", ttynum, this);
@@ -969,6 +971,14 @@ fhandler_tty_common::close ()
termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
if (!ForceCloseHandle (input_mutex))
termios_printf ("CloseHandle (input_mutex<%p>), %E", input_mutex);
+
+ /* Send EOF to slaves if master side is closed */
+ if (!get_ttyp ()->master_alive ())
+ {
+ termios_printf ("no more masters left. sending EOF" );
+ SetEvent (input_available_event);
+ }
+
if (!ForceCloseHandle (input_available_event))
termios_printf ("CloseHandle (input_available_event<%p>), %E", input_available_event);
if (!ForceCloseHandle1 (get_handle (), from_pty))