Fixed thread handling.

This commit is contained in:
Armin Novak 2013-09-05 13:38:56 +02:00
parent 1d416ff387
commit d2fec8f612
1 changed files with 6 additions and 1 deletions

View File

@ -200,6 +200,8 @@ static void* printer_thread_func(void* arg)
printer_process_irp(printer_dev, irp);
}
ExitThread(0);
return NULL;
}
@ -219,11 +221,14 @@ static void printer_free(DEVICE* device)
SetEvent(printer_dev->stopEvent);
WaitForSingleObject(printer_dev->thread, INFINITE);
CloseHandle(printer_dev->thread);
while ((irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList)) != NULL)
irp->Discard(irp);
CloseHandle(printer_dev->thread);
CloseHandle(printer_dev->stopEvent);
CloseHandle(printer_dev->event);
_aligned_free(printer_dev->pIrpList);
if (printer_dev->printer)