* fhandler_serial.cc (fhandler_serial::raw_read): Handle non-blocking
case more thoroughly.
This commit is contained in:
parent
b4efd5410c
commit
f55fc99c77
|
@ -1,3 +1,8 @@
|
||||||
|
2011-07-13 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_serial.cc (fhandler_serial::raw_read): Handle non-blocking
|
||||||
|
case more thoroughly.
|
||||||
|
|
||||||
2011-07-13 Christopher Faylor <me.cygwin2011@cgf.cx>
|
2011-07-13 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* setup_handler (setup_handler): Change break to goto out, missed in
|
* setup_handler (setup_handler): Change break to goto out, missed in
|
||||||
|
|
|
@ -81,7 +81,17 @@ fhandler_serial::raw_read (void *ptr, size_t& ulen)
|
||||||
}
|
}
|
||||||
else if (GetLastError () != ERROR_IO_PENDING)
|
else if (GetLastError () != ERROR_IO_PENDING)
|
||||||
goto err;
|
goto err;
|
||||||
else if (!is_nonblocking ())
|
else if (is_nonblocking ())
|
||||||
|
{
|
||||||
|
PurgeComm (get_handle (), PURGE_RXABORT);
|
||||||
|
if (tot == 0)
|
||||||
|
{
|
||||||
|
tot = -1;
|
||||||
|
set_errno (EAGAIN);
|
||||||
|
}
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
HANDLE w4[3] = { io_status.hEvent, signal_arrived,
|
HANDLE w4[3] = { io_status.hEvent, signal_arrived,
|
||||||
pthread::get_cancel_event () };
|
pthread::get_cancel_event () };
|
||||||
|
@ -124,6 +134,16 @@ restart:
|
||||||
/* Got something */;
|
/* Got something */;
|
||||||
else if (GetLastError () != ERROR_IO_PENDING)
|
else if (GetLastError () != ERROR_IO_PENDING)
|
||||||
goto err;
|
goto err;
|
||||||
|
else if (is_nonblocking ())
|
||||||
|
{
|
||||||
|
PurgeComm (get_handle (), PURGE_RXABORT);
|
||||||
|
if (tot == 0)
|
||||||
|
{
|
||||||
|
tot = -1;
|
||||||
|
set_errno (EAGAIN);
|
||||||
|
}
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
else if (!GetOverlappedResult (get_handle (), &io_status, &n, TRUE))
|
else if (!GetOverlappedResult (get_handle (), &io_status, &n, TRUE))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue