* 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:
@@ -23,7 +23,9 @@ details. */
|
||||
#define IOCTL_REQUEST_EVENT "cygtty%d.ioctl.request"
|
||||
#define IOCTL_DONE_EVENT "cygtty%d.ioctl.done"
|
||||
#define RESTART_OUTPUT_EVENT "cygtty%d.output.restart"
|
||||
#define INPUT_AVAILABLE_EVENT "cygtty%d.input.avail"
|
||||
#define OUTPUT_MUTEX "cygtty%d.output.mutex"
|
||||
#define INPUT_MUTEX "cygtty%d.input.mutex"
|
||||
#define TTY_SLAVE_ALIVE "cygtty%x.slave_alive"
|
||||
#define TTY_MASTER_ALIVE "cygtty%x.master_alive"
|
||||
|
||||
@@ -111,6 +113,12 @@ public:
|
||||
__small_sprintf (buf, OUTPUT_MUTEX, ntty);
|
||||
return OpenMutex (MUTEX_ALL_ACCESS, inherit, buf);
|
||||
}
|
||||
HANDLE open_input_mutex (BOOL inherit = FALSE)
|
||||
{
|
||||
char buf[80];
|
||||
__small_sprintf (buf, INPUT_MUTEX, ntty);
|
||||
return OpenMutex (MUTEX_ALL_ACCESS, inherit, buf);
|
||||
}
|
||||
BOOL exists ()
|
||||
{
|
||||
HANDLE h = open_output_mutex ();
|
||||
|
Reference in New Issue
Block a user