From 306c4b6737136c7bb45228c284502eb643ec95ac Mon Sep 17 00:00:00 2001 From: Egor Duda Date: Sun, 4 Mar 2001 15:34:25 +0000 Subject: * fhandler.h (class fhandler_tty_common): New mutex and event to syncronize input on master tty with slave tty. * fhandler_tty.cc (fhandler_pty_master::accept_input): Use them to syncronize with slave. * fhandler_tty.cc (fhandler_tty_slave::read): Use input mutex and event to syncronize with master. Do not limit amount of data read from master to vmin value. Interrupt on signal and return already read data, if any. * fhandler_tty.cc (fhandler_tty_slave::open): Handle input mutex and event. * fhandler_tty.cc (fhandler_tty_common::close): Ditto. * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Ditto. * fhandler_tty.cc (fhandler_tty_common::fixup_after_fork): Ditto. * fhandler_tty.cc (fhandler_tty_common::dup): Ditto. * tty.h (tty::open_input_mutex): New function. * tty.cc (tty::common_init): Create input mutex and event. --- winsup/cygwin/tty.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'winsup/cygwin/tty.cc') diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index baff0a4c2..070fa3e28 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -408,6 +408,9 @@ tty::common_init (fhandler_pty_master *ptym) return FALSE; } + if (!(ptym->input_available_event = get_event (INPUT_AVAILABLE_EVENT, FALSE))) + return FALSE; + char buf[40]; __small_sprintf (buf, OUTPUT_MUTEX, ntty); if (!(ptym->output_mutex = CreateMutex (&sec_all, FALSE, buf))) @@ -417,7 +420,16 @@ tty::common_init (fhandler_pty_master *ptym) return FALSE; } + __small_sprintf (buf, INPUT_MUTEX, ntty); + if (!(ptym->input_mutex = CreateMutex (&sec_all, FALSE, buf))) + { + termios_printf ("can't create %s", buf); + set_errno (ENOENT); + return FALSE; + } + ProtectHandle1 (ptym->output_mutex, output_mutex); + ProtectHandle1 (ptym->input_mutex, input_mutex); winsize.ws_col = 80; winsize.ws_row = 25; -- cgit v1.2.3