* fhandler_console.cc (fhandler_console::read): Make restartable and
cancelable.
This commit is contained in:
parent
d85a0c243b
commit
e4f70cddcd
|
@ -1,3 +1,8 @@
|
||||||
|
2011-05-02 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_console.cc (fhandler_console::read): Make restartable and
|
||||||
|
cancelable.
|
||||||
|
|
||||||
2011-05-02 Christopher Faylor <me.cygwin2011@cgf.cx>
|
2011-05-02 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* strace.cc (strace::vprntf): Avoid closing unopened handle.
|
* strace.cc (strace::vprntf): Avoid closing unopened handle.
|
||||||
|
|
|
@ -262,19 +262,11 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE w4[2];
|
HANDLE w4[3] = { h, signal_arrived, pthread::get_cancel_event () };
|
||||||
DWORD nwait;
|
DWORD nwait = w4[2] ? 3 : 2;
|
||||||
|
DWORD timeout = is_nonblocking () ? 0 : INFINITE;
|
||||||
char tmp[60];
|
char tmp[60];
|
||||||
|
|
||||||
w4[0] = h;
|
|
||||||
if (&_my_tls != _main_tls)
|
|
||||||
nwait = 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w4[1] = signal_arrived;
|
|
||||||
nwait = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
termios ti = tc->ti;
|
termios ti = tc->ti;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -286,12 +278,22 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_cursor_maybe (); /* to make cursor appear on the screen immediately */
|
set_cursor_maybe (); /* to make cursor appear on the screen immediately */
|
||||||
switch (WaitForMultipleObjects (nwait, w4, FALSE, INFINITE))
|
restart:
|
||||||
|
switch (WaitForMultipleObjects (nwait, w4, FALSE, timeout))
|
||||||
{
|
{
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
break;
|
break;
|
||||||
case WAIT_OBJECT_0 + 1:
|
case WAIT_OBJECT_0 + 1:
|
||||||
|
if (_my_tls.call_signal_handler ())
|
||||||
|
goto restart;
|
||||||
goto sig_exit;
|
goto sig_exit;
|
||||||
|
case WAIT_OBJECT_0 + 2:
|
||||||
|
pthread::static_cancel_self ();
|
||||||
|
/*NOTREACHED*/
|
||||||
|
case WAIT_TIMEOUT:
|
||||||
|
set_sig_errno (EAGAIN);
|
||||||
|
buflen = (size_t) -1;
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue