- if (eventChain == inEvent)
- eventChain = inEvent->getNext();
- else {
- IOEventSource *event, *next;
-
- event = eventChain;
- while ((next = event->getNext()) && next != inEvent)
- event = next;
-
- if (!next) {
- res = kIOReturnBadArgument;
- break;
+ if (inEvent->getWorkLoop()) {
+ if (eventChain == inEvent)
+ eventChain = inEvent->getNext();
+ else {
+ IOEventSource *event, *next;
+
+ event = eventChain;
+ while ((next = event->getNext()) && next != inEvent)
+ event = next;
+
+ if (!next) {
+ res = kIOReturnBadArgument;
+ break;
+ }
+ event->setNext(inEvent->getNext());