]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOService.cpp
xnu-4570.51.1.tar.gz
[apple/xnu.git] / iokit / Kernel / IOService.cpp
index 207c8dc29fa316f452a0ca3aed6e07662d89331f..5395c1dc362debae2ca187aa814b80f2f1117eff 100644 (file)
@@ -2278,16 +2278,20 @@ void IOService::scheduleTerminatePhase2( IOOptionBits options )
                terminateWorker( options );
             wait = (0 != (__state[1] & kIOServiceBusyStateMask));
             if( wait) {
-                // wait for the victim to go non-busy
+                /* wait for the victim to go non-busy */
                 if( !haveDeadline) {
                     clock_interval_to_deadline( 15, kSecondScale, &deadline );
                     haveDeadline = true;
                 }
+                /* let others do work while we wait */
+                gIOTerminateThread = 0;
+                IOLockWakeup( gJobsLock, (event_t) &gIOTerminateThread, /* one-thread */ false);
                 waitResult = IOLockSleepDeadline( gJobsLock, &gIOTerminateWork,
                                                   deadline, THREAD_UNINT );
-                if(__improbable(waitResult == THREAD_TIMED_OUT)) {
+                if (__improbable(waitResult == THREAD_TIMED_OUT)) {
                     panic("%s[0x%qx]::terminate(kIOServiceSynchronous) timeout\n", getName(), getRegistryEntryID());
-               }
+                }
+                waitToBecomeTerminateThread();
             }
         } while(gIOTerminateWork || (wait && (waitResult != THREAD_TIMED_OUT)));