diff --git a/Tests/KernelTests/main.m b/Tests/KernelTests/main.m index ed2bf2649..c3e6d95c5 100644 --- a/Tests/KernelTests/main.m +++ b/Tests/KernelTests/main.m @@ -193,7 +193,7 @@ - (void)beginListening { /// Begin listening for events queueMemory = (IODataQueueMemory *)address; - while (IODataQueueWaitForAvailableData(queueMemory, receivePort) == kIOReturnSuccess) { + do { while (IODataQueueDataAvailable(queueMemory)) { dataSize = sizeof(vdata); kr = IODataQueueDequeue(queueMemory, &vdata, &dataSize); @@ -227,7 +227,7 @@ - (void)beginListening { TFAILINFO("Error receiving data: %d", kr); } } - } + } while (IODataQueueWaitForAvailableData(queueMemory, receivePort) == kIOReturnSuccess); IOConnectUnmapMemory(self.connection, kIODefaultMemoryType, mach_task_self(), address); mach_port_destroy(mach_task_self(), receivePort);