diff --git a/serialport.c b/serialport.c index 1daba1c..4a2fc59 100644 --- a/serialport.c +++ b/serialport.c @@ -428,6 +428,9 @@ static enum sp_return restart_wait(struct sp_port *port) &wait_result, FALSE)) { DEBUG("Previous wait completed"); port->wait_running = FALSE; + } else if (GetLastError() == ERROR_OPERATION_ABORTED) { + DEBUG("Previous wait ended due to previous thread exiting"); + port->wait_running = FALSE; } else if (GetLastError() == ERROR_IO_INCOMPLETE) { DEBUG("Previous wait still running"); RETURN_OK();