Reset file descriptor set only, if necessary now.

This commit is contained in:
Armin Novak 2013-08-16 12:40:06 +02:00
parent 1a3a6c3e0f
commit 60d38daf0a

View File

@ -340,6 +340,8 @@ static void* serial_thread_func(void* arg)
if (WAIT_OBJECT_0 == status)
break;
if (status == WAIT_OBJECT_0 + 1)
{
FD_ZERO(&serial->read_fds);
FD_ZERO(&serial->write_fds);
@ -347,13 +349,12 @@ static void* serial_thread_func(void* arg)
serial->tv.tv_usec = 0;
serial->select_timeout = 0;
if (status == WAIT_OBJECT_0 + 1)
{
if ((irp = (IRP*) Queue_Dequeue(serial->queue)))
serial_process_irp(serial, irp);
continue;
}
if(serial->tty)
serial_check_fds(serial);
}
@ -680,6 +681,13 @@ static BOOL serial_check_fds(SERIAL_DEVICE* serial)
if (list_size(serial->pending_irps) == 0)
return 1;
FD_ZERO(&serial->read_fds);
FD_ZERO(&serial->write_fds);
serial->tv.tv_sec = 0;
serial->tv.tv_usec = 0;
serial->select_timeout = 0;
serial_set_fds(serial);
DEBUG_SVC("waiting %lu %lu", serial->tv.tv_sec, serial->tv.tv_usec);