static void* drive_thread_func(void* arg) { IRP* irp; wMessage message; DRIVE_DEVICE* drive = (DRIVE_DEVICE*) arg; while (1) { if (!MessageQueue_Wait(drive->IrpQueue)) break; if (!MessageQueue_Peek(drive->IrpQueue, &message, TRUE)) break; if (message.id == WMQ_QUIT) break; irp = (IRP*) message.wParam; if (irp) drive_process_irp(drive, irp); } ExitThread(0); return NULL; }
static void drive_process_irp_list(DRIVE_DEVICE* disk) { IRP* irp; while (1) { if (WaitForSingleObject(disk->stopEvent, 0) == WAIT_OBJECT_0) break; irp = (IRP*) InterlockedPopEntrySList(disk->pIrpList); if (irp == NULL) break; drive_process_irp(disk, irp); } }
static void* drive_thread_func(void* arg) { IRP* irp; wMessage message; DRIVE_DEVICE* drive = (DRIVE_DEVICE*) arg; UINT error = CHANNEL_RC_OK; while (1) { if (!MessageQueue_Wait(drive->IrpQueue)) { WLog_ERR(TAG, "MessageQueue_Wait failed!"); error = ERROR_INTERNAL_ERROR; break; } if (!MessageQueue_Peek(drive->IrpQueue, &message, TRUE)) { WLog_ERR(TAG, "MessageQueue_Peek failed!"); error = ERROR_INTERNAL_ERROR; break; } if (message.id == WMQ_QUIT) break; irp = (IRP*) message.wParam; if (irp) if ((error = drive_process_irp(drive, irp))) { WLog_ERR(TAG, "drive_process_irp failed with error %u!", error); break; } } if (error && drive->rdpcontext) setChannelError(drive->rdpcontext, error, "drive_thread_func reported an error"); ExitThread((DWORD)error); return NULL; }