Q:
I am receiving kIOReturnUnderrun errors when calling the
HID Manager's getNextEvent function with a timoutMS of zero
(the non-blocking mode). What does this mean and what should
I do about it?
A:
This is a normal condition and signifies no events pending
in the queue and thus no data to return. The event parameter
should be ignored in this case and will not contain valid
data. Your event handling should take this into consideration
as a normal mode of operation. See listing 1 for an example.
AbsoluteTime zeroTime = {0,0};
result = (*queue)->getNextEvent (queue, &event, zeroTime, 0);
if (result == kIOReturnUnderrun)
{
// do nothing queue empty, event invalid
}
else if (result != kIOReturnSuccess)
{
// error
}
else
{
// retrieved valid event
}
|
Listing 1. Correctly handling empty queues
|
[Jun 13 2001]
|