Fixed #1404, using WaitForMultipleObjects now.

This commit is contained in:
Armin Novak 2013-08-08 14:46:21 +02:00
parent ca215eea69
commit 44c80c29cc

View File

@ -179,13 +179,16 @@ static void* printer_thread_func(void* arg)
{ {
IRP* irp; IRP* irp;
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) arg; PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) arg;
HANDLE obj[] = {printer_dev->event, printer_dev->stopEvent};
while (1) while (1)
{ {
WaitForSingleObject(printer_dev->event, INFINITE); DWORD rc = WaitForMultipleObjects(2, obj, FALSE, INFINITE);
if (WaitForSingleObject(printer_dev->stopEvent, 0) == WAIT_OBJECT_0) if (rc == WAIT_OBJECT_0 + 1)
break; break;
else if( rc != WAIT_OBJECT_0 )
continue;
ResetEvent(printer_dev->event); ResetEvent(printer_dev->event);