Cygwin: serial: wait for CancelIo completion
Per https://devblogs.microsoft.com/oldnewthing/20110202-00/?p=11613 GetOverlappedResult must be called blocking, waiting for the overlapped operation to complete. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
b37a3388cc
commit
7947581905
|
@ -135,7 +135,7 @@ fhandler_serial::raw_read (void *ptr, size_t& ulen)
|
||||||
PurgeComm apparently discards in-flight bytes while CancelIo
|
PurgeComm apparently discards in-flight bytes while CancelIo
|
||||||
only stops the overlapped IO routine. */
|
only stops the overlapped IO routine. */
|
||||||
CancelIo (get_handle ());
|
CancelIo (get_handle ());
|
||||||
if (GetOverlappedResult (get_handle (), &io_status, &n, FALSE))
|
if (GetOverlappedResult (get_handle (), &io_status, &n, TRUE))
|
||||||
tot = n;
|
tot = n;
|
||||||
else if (GetLastError () != ERROR_OPERATION_ABORTED)
|
else if (GetLastError () != ERROR_OPERATION_ABORTED)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
Loading…
Reference in New Issue