mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
windows: Handle ERROR_IO_PENDING from ReadFile in sp_nonblocking_read().
This fixes bug #707.
This commit is contained in:
parent
127d8d0ce7
commit
ae2c5825e7
@ -1234,10 +1234,11 @@ SP_API enum sp_return sp_nonblocking_read(struct sp_port *port, void *buf,
|
||||
|
||||
/* Do read. */
|
||||
if (ReadFile(port->hdl, buf, count, NULL, &port->read_ovl) == 0)
|
||||
if (GetLastError() != ERROR_IO_PENDING)
|
||||
RETURN_FAIL("ReadFile() failed");
|
||||
|
||||
/* Get number of bytes read. */
|
||||
if (GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, TRUE) == 0)
|
||||
if (GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, FALSE) == 0)
|
||||
RETURN_FAIL("GetOverlappedResult() failed");
|
||||
|
||||
TRY(restart_wait_if_needed(port, bytes_read));
|
||||
|
Loading…
Reference in New Issue
Block a user