X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6d2010ae8f7a6078e10b361c6962983bab233e0f..7e41aa883dd258f888d0470250eead40a53ef1f5:/iokit/Kernel/IOWorkLoop.cpp diff --git a/iokit/Kernel/IOWorkLoop.cpp b/iokit/Kernel/IOWorkLoop.cpp index 51045a234..6207b1ea1 100644 --- a/iokit/Kernel/IOWorkLoop.cpp +++ b/iokit/Kernel/IOWorkLoop.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #define super OSObject @@ -143,11 +144,6 @@ bool IOWorkLoop::init() workToDo = false; } - if (!reserved) { - reserved = IONew(ExpansionData, 1); - reserved->options = 0; - } - IOStatisticsRegisterCounter(); if ( controlG == NULL ) { @@ -177,6 +173,7 @@ bool IOWorkLoop::init() return false; } + (void) thread_set_tag(workThread, THREAD_TAG_IOWORKLOOP); return true; } @@ -258,6 +255,7 @@ void IOWorkLoop::free() // Either way clean up all of our resources and return. if (controlG) { + controlG->workLoop = 0; controlG->release(); controlG = 0; } @@ -556,14 +554,16 @@ IOReturn IOWorkLoop::_maintRequest(void *inC, void *inD, void *, void *) case mRemoveEvent: if (inEvent->getWorkLoop()) { + IOStatisticsDetachEventSource(); + if (eventSourcePerformsWork(inEvent)) { if (eventChain == inEvent) eventChain = inEvent->getNext(); else { - IOEventSource *event, *next; + IOEventSource *event, *next = 0; event = eventChain; - while ((next = event->getNext()) && next != inEvent) + if (event) while ((next = event->getNext()) && (next != inEvent)) event = next; if (!next) { @@ -577,10 +577,10 @@ IOReturn IOWorkLoop::_maintRequest(void *inC, void *inD, void *, void *) if (passiveEventChain == inEvent) passiveEventChain = inEvent->getNext(); else { - IOEventSource *event, *next; + IOEventSource *event, *next = 0; event = passiveEventChain; - while ((next = event->getNext()) && next != inEvent) + if (event) while ((next = event->getNext()) && (next != inEvent)) event = next; if (!next) { @@ -595,7 +595,6 @@ IOReturn IOWorkLoop::_maintRequest(void *inC, void *inD, void *, void *) inEvent->setNext(0); inEvent->release(); SETP(&fFlags, kLoopRestart); - IOStatisticsDetachEventSource(); } break;