* fhndler_tty.cc (andler_pty_master::process_slave_output): Make

interruptible and cancelable.  Fix nonblocking case.
This commit is contained in:
Corinna Vinschen 2011-05-02 18:41:10 +00:00
parent e4f70cddcd
commit 27dd7bfbcd
2 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2011-05-02 Corinna Vinschen <corinna@vinschen.de>
* fhndler_tty.cc (andler_pty_master::process_slave_output): Make
interruptible and cancelable. Fix nonblocking case.
2011-05-02 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::read): Make restartable and

View File

@ -305,16 +305,23 @@ fhandler_pty_master::process_slave_output (char *buf, size_t len, int pktmode_on
if (hit_eof ())
goto out;
/* DISCARD (FLUSHO) and tcflush can finish here. */
if (n == 0 && (get_ttyp ()->ti.c_lflag & FLUSHO || !buf))
if ((get_ttyp ()->ti.c_lflag & FLUSHO || !buf))
goto out;
if (n == 0 && is_nonblocking ())
if (is_nonblocking ())
{
set_errno (EAGAIN);
rc = -1;
break;
goto out;
}
Sleep (10);
pthread_testcancel ();
if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0
&& !_my_tls.call_signal_handler ())
{
set_errno (EINTR);
rc = -1;
goto out;
}
}
if (ReadFile (handle, outbuf, rlen, &n, NULL) == FALSE)