* 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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user