site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Thread-index: Acg9vZ4P3JwFbKmwEdyV5gAX8si2KA== Thread-topic: IOCommandGate commandSleep/commandWakeup User-agent: Microsoft-Entourage/11.3.6.070618 Hi, I'm encountering a problem where calling commandWakeup() on an IOCommandGate is failing to wake up the sleeping thread. This describes how I though things were supposed to work: Some code calls: myCommandGate->runCommand(NULL, NULL, NULL, NULL); The command gate runs its action: IOReturn com_myCompany_driver::waitForMonkey( OSObject *owner, void*, void*, void*, void* ) { com_myCompany_driver *driver; IOReturn kr = kIOReturnSuccess; driver = OSDynamicCast( com_myCompany_driver, owner); // Make sure that this driver type is the sender of the command. SIGNAL_IF(driver == NULL); if (driver) { driver->tellMonkeyToFling(); // calls messageClients driver->isSleeping = true; kr = driver->myCommandGate->commandSleep(&(driver->isSleeping), THREAD_ABORTSAFE); driver->isSleeping = false; if (kr != THREAD_AWAKENED) { DEBUG_LOG("commandSleep() returned error %08x!", kr); } else { DEBUG_LOG("Driver %p resuming thread after sleep", driver); } } } Then when the monkey responds, wake the thread up: void com_myCompany_driver::handleMonkeyResponse( bool inResponse ) { monkeyResponse = inResponse; myCommandGate->commandWakeup(&isSleeping, false); DEBUG_LOG("Called commandWakeup for driver %p", this); } In the system log, I see the log messages I expect. It looks like everything happened that should happen, except in some instances, the sleeping thread never wakes up (and thus I never see the "Driver x resuming thread after sleep" message, but I do see the "Called commandWakeup for driver x" message. It's like commandWakeup did nothing. Eric _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Eric Long