MessageQueue_PostQuit(parallel->queue, 0);
WaitForSingleObject(parallel->thread, INFINITE);
+ Stream_Free(parallel->device.data, TRUE);
MessageQueue_Free(parallel->queue);
CloseHandle(parallel->thread);
DEBUG_SVC("freeing device");
+ /* Stop thread */
SetEvent(serial->stopEvent);
-
- /* TODO: free lists */
-
+ WaitForSingleObject(serial->thread, INFINITE);
+
+ /* Clean up resources */
+ Stream_Free(serial->device.data, TRUE);
+ Queue_Free(serial->queue);
+ list_free(serial->pending_irps);
+ CloseHandle(serial->stopEvent);
+ CloseHandle(serial->thread);
free(serial);
}