当前位置: 首页>>代码示例>>C++>>正文


C++ IOWorkLoop类代码示例

本文整理汇总了C++中IOWorkLoop的典型用法代码示例。如果您正苦于以下问题:C++ IOWorkLoop类的具体用法?C++ IOWorkLoop怎么用?C++ IOWorkLoop使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IOWorkLoop类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: start

bool AiroJackUserClient::
start(IOService* provider)
{
    WLLogInfo("AiroJackUserClient::start()\n");

    if (!super::start(provider)) {
        WLLogErr("AiroJackUserClient: start: super::start() failed\n");
        return false;
    }

    _provider = OSDynamicCast(AiroJackDriver, provider);

    if (!_provider)
        return false;

    _wlCard = _provider->getWLCard();

    _userCommandGate = IOCommandGate::commandGate(this);
    if (!_userCommandGate) {
        WLLogErr("AiroJackUserClient::start: Couldn't get CommandGate\n");
        return false;
    }

    IOWorkLoop* wl = _provider->getWorkLoop();
    if (wl->addEventSource(_userCommandGate) != kIOReturnSuccess) {
        WLLogErr("AiroJackUserClient::start: Couldn't add gate to workloop\n");
        return false;
    }

    _packetQueue = _provider->getPacketQueue();

    return true;
}
开发者ID:ianblenke,项目名称:kismac-ng,代码行数:33,代码来源:AiroJackUserClient.cpp

示例2: getWorkLoop

bool
org_virtualbox_VBoxGuest::setupVmmDevInterrupts(IOService *pProvider)
{
    IOWorkLoop *pWorkLoop = getWorkLoop();

    if (!pWorkLoop)
        return false;

    m_pInterruptSrc = IOFilterInterruptEventSource::filterInterruptEventSource(this,
                                                                               &deferredInterruptHandler,
                                                                               &directInterruptHandler,
                                                                               pProvider);

    if (kIOReturnSuccess != pWorkLoop->addEventSource(m_pInterruptSrc))
    {
        m_pInterruptSrc->disable();
        m_pInterruptSrc->release();
        m_pInterruptSrc = 0;
        return false;
    }

    m_pInterruptSrc->enable();

    return true;
}
开发者ID:Rootkitsmm,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:25,代码来源:VBoxGuest-darwin.cpp

示例3: sleepGate

/* virtual */ void IOCommandGate::setWorkLoop(IOWorkLoop *inWorkLoop)
{
    IOWorkLoop * wl;
    uintptr_t  * sleepersP = (uintptr_t *) &reserved;
    bool         defer;

    if (!inWorkLoop && (wl = workLoop)) {		// tearing down
	wl->closeGate();
	*sleepersP |= kSleepersRemoved;
	while (*sleepersP & kSleepersWaitEnabled) {
	    thread_wakeup_with_result(&enabled, THREAD_INTERRUPTED);
	    sleepGate(sleepersP, THREAD_UNINT);
	}
	*sleepersP &= ~kSleepersWaitEnabled;
	defer = (0 != (kSleepersActionsMask & *sleepersP));
	if (!defer)
	{
	    super::setWorkLoop(0);
	    *sleepersP &= ~kSleepersRemoved;
	}
	wl->openGate();
	return;
    }

    super::setWorkLoop(inWorkLoop);
}
开发者ID:JackieXie168,项目名称:xnu,代码行数:26,代码来源:IOCommandGate.cpp

示例4: getWorkLoop

void IOHIDEventSystemUserClient::stop( IOService * provider )
{
    IOWorkLoop * workLoop = getWorkLoop();
    if (workLoop && commandGate)
    {
        workLoop->removeEventSource(commandGate);
    }
}
开发者ID:wzw19890321,项目名称:IOHIDFamily,代码行数:8,代码来源:IOHIDUserClient.cpp

示例5: IOLog

void SoftU2FUserClient::stop(IOService *provider) {
  IOLog("%s[%p]::%s(%p)\n", getName(), this, __FUNCTION__, provider);

  IOWorkLoop *workLoop = getWorkLoop();
  if (workLoop && _commandGate)
    workLoop->removeEventSource(_commandGate);

  super::stop(provider);
}
开发者ID:charlie-j,项目名称:SoftU2F,代码行数:9,代码来源:SoftU2FUserClient.cpp

示例6: CreateControls

bool	AREngine::initHardware(IOService* inProvider)
{
	bool theAnswer = false;
	
	if(IOAudioEngine::initHardware(inProvider))
	{
		IOAudioSampleRate theInitialSampleRate = { 0, 0 };
		UInt32 theNumberChannels = 0;
		
		//	create the streams
		if(CreateStreams(&theInitialSampleRate, &theNumberChannels) && (theInitialSampleRate.whole != 0))
		{
			CreateControls(theNumberChannels);
			
			//	figure out how long each block is in microseconds
			mBlockTimeoutMicroseconds = 1000000 * mBlockSize / theInitialSampleRate.whole;
			
			setSampleRate(&theInitialSampleRate);
			
			// Set the number of sample frames in each buffer
			setNumSampleFramesPerBuffer(mBlockSize * mNumberBlocks);
			
			//	set up the timer
			IOWorkLoop* theWorkLoop = getWorkLoop();
			if(theWorkLoop != NULL)
			{
				mTimerEventSource = IOTimerEventSource::timerEventSource(this, TimerFired);
				if(mTimerEventSource != NULL)
				{
					theWorkLoop->addEventSource(mTimerEventSource);
					theAnswer = true;
				}
			}
			
			//	set the safety offset
			//	note that due to cache issues, it probably isn't wise to leave the safety offset at 0,
			//	we set it to 4 here, just to be safe.
			setSampleOffset(4);
			
			//	set up the time stamp generator
			mTimeStampGenerator.SetSampleRate(theInitialSampleRate.whole);
			mTimeStampGenerator.SetFramesPerRingBuffer(mBlockSize * mNumberBlocks);
			
			//	nate that the rate scalar is a 4.28 fixed point number
			//	this means that each incremnt is 1/2^28
			mTimeStampGenerator.SetRateScalar(1UL << 28);
			
			//	set the maximum jitter
//			AbsoluteTime theMaximumJitter = { 0, 0 };
//			nanoseconds_to_absolutetime(5ULL * 1000ULL, &theMaximumJitter);
//			mTimeStampGenerator.SetMaximumJitter(theMaximumJitter.lo);
		}
	}
	
	return theAnswer;
}
开发者ID:paulz,项目名称:zirkonium,代码行数:56,代码来源:AREngine.cpp

示例7: ELG

bool RTL8139::initEventSources( IOService *provider )
{
	ELG( 0, 0, 'InES', "RTL8139::initEventSources - " );
    DEBUG_LOG( "initEventSources() ===>\n" );

	IOWorkLoop	*wl = getWorkLoop();
	if ( 0 == wl )
        return false;

	fTransmitQueue = getOutputQueue();
	if ( 0 == fTransmitQueue )
        return false;
	fTransmitQueue->setCapacity( kTransmitQueueCapacity );

		// Create an interrupt event source to handle hardware interrupts.

	interruptSrc = IOInterruptEventSource::interruptEventSource(
						this,
					   OSMemberFunctionCast(	IOInterruptEventAction,
												this,
												&RTL8139::interruptOccurred ),
					   provider );

	if ( !interruptSrc || (wl->addEventSource( interruptSrc ) != kIOReturnSuccess) )
		return false;

		// This is important. If the interrupt line is shared with other devices,
		// then the interrupt vector will be enabled only if all corresponding
		// interrupt event sources are enabled. To avoid masking interrupts for
		// other devices that are sharing the interrupt line, the event source
		// is enabled immediately. Hardware interrupt sources remain disabled.

    interruptSrc->enable();

		// Register a timer event source used as a watchdog timer:

	timerSrc = IOTimerEventSource::timerEventSource(
					this,
					OSMemberFunctionCast(	IOTimerEventSource::Action,
											this,
											&RTL8139::timeoutOccurred ) );

	if ( !timerSrc || (wl->addEventSource( timerSrc ) != kIOReturnSuccess) )
		return false;

		// Create a dictionary to hold IONetworkMedium objects:

	mediumDict = OSDictionary::withCapacity( 5 );
	if ( 0 == mediumDict )
		return false;

	DEBUG_LOG( "initEventSources() <===\n" );
	return true;
}/* end initEventSources */
开发者ID:csekel,项目名称:AppleRTL8139Ethernet_puredarwin,代码行数:54,代码来源:RTL8139.cpp

示例8: FWKLOG

void IOFireWireSBP2LUN::free( void )
{
	FWKLOG( ( "IOFireWireSBP2LUN<%p> : free\n", this ) );

	//
	// free unreleased orbs
	//
	
//	flushAllManagementORBs();
		
	if( fORBSetIterator )			
		fORBSetIterator->release();

	if( fORBSet )
		fORBSet->release();

    //
    // release login set
    //
    
	if( fLoginSetIterator )			
		fLoginSetIterator->release();

	if( fLoginSet )
		fLoginSet->release();

	//
	// destroy command gate
	//
	
	if( fGate != NULL )
	{
		IOWorkLoop * workLoop = NULL;

		workLoop = fGate->getWorkLoop();
		workLoop->removeEventSource( fGate );
		workLoop->release();

		fGate->release();
		fGate = NULL;
	}
	
	if( fProviderTarget )
	{
		fProviderTarget->release();
		fProviderTarget = NULL;
	}
			
	IOService::free();
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:50,代码来源:IOFireWireSBP2LUN.cpp

示例9: clock_get_uptime

void BrcmPatchRAM::stop(IOService* provider)
{
    uint64_t stop_time, nano_secs;
    clock_get_uptime(&stop_time);
    absolutetime_to_nanoseconds(stop_time - wake_time, &nano_secs);
    uint64_t milli_secs = nano_secs / 1000000;
    AlwaysLog("Time since wake %llu.%llu seconds.\n", milli_secs / 1000, milli_secs % 1000);


    DebugLog("stop\n");

    OSSafeReleaseNULL(mFirmwareStore);

    IOWorkLoop* workLoop = getWorkLoop();
    if (workLoop)
    {
        if (mTimer)
        {
            mTimer->cancelTimeout();
            workLoop->removeEventSource(mTimer);
            mTimer->release();
            mTimer = NULL;
        }
        if (mWorkSource)
        {
            workLoop->removeEventSource(mWorkSource);
            mWorkSource->release();
            mWorkSource = NULL;
            mWorkPending = 0;
        }
    }

    PMstop();

    if (mCompletionLock)
    {
        IOLockFree(mCompletionLock);
        mCompletionLock = NULL;
    }
    if (mWorkLock)
    {
        IOLockFree(mWorkLock);
        mWorkLock = NULL;
    }

    OSSafeReleaseNULL(mDevice);

    super::stop(provider);
}
开发者ID:andyvand,项目名称:OS-X-BrcmPatchRAM,代码行数:49,代码来源:BrcmPatchRAM.cpp

示例10:

void
IOCommandPool::free(void)
{
    if (fSerializer) {
        // remove our event source from owner's workloop
        IOWorkLoop *wl = fSerializer->getWorkLoop();
        if (wl)
            wl->removeEventSource(fSerializer);

        fSerializer->release();
        fSerializer = 0;
    }

    // Tell our superclass to cleanup too
    super::free();
}
开发者ID:JackieXie168,项目名称:xnu,代码行数:16,代码来源:IOCommandPool.cpp

示例11: getWorkLoop

//---------------------------------------------------------------------------
bool AgereET131x::initEventSources( IOService* provider )
{
	// Get a handle to our superclass' workloop.
	//
	IOWorkLoop* myWorkLoop = (IOWorkLoop *) getWorkLoop();
	if (myWorkLoop == NULL) {
		IOLog(" myWorkLoop is NULL.\n");
		return false;
	}
	
	transmitQueue = getOutputQueue();
	if (transmitQueue == NULL) {
		IOLog("getOutputQueue failed.\n");
		return false;
	}
	transmitQueue->setCapacity(NUM_TCB);
	
	interruptSource = IOFilterInterruptEventSource::filterInterruptEventSource( this, &AgereET131x::interruptHandler, &AgereET131x::interruptFilter, provider);
	
	if (!interruptSource ||
		(myWorkLoop->addEventSource(interruptSource) != kIOReturnSuccess)) {
		IOLog("workloop add eventsource interrupt source.\n");
		return false;
	}
	
	// This is important. If the interrupt line is shared with other devices,
	// then the interrupt vector will be enabled only if all corresponding
	// interrupt event sources are enabled. To avoid masking interrupts for
	// other devices that are sharing the interrupt line, the event source
	// is enabled immediately.
	interruptSource->enable();
	
	// Register a timer event source. This is used as a watchdog timer.
	//
	watchdogSource = IOTimerEventSource::timerEventSource(this, &AgereET131x::timeoutHandler );
	if (!watchdogSource || (myWorkLoop->addEventSource(watchdogSource) != kIOReturnSuccess)) {
		IOLog("watchdogSource create failed.\n");
		return false;
	}
	
	mediumDict = OSDictionary::withCapacity(MEDIUM_INDEX_COUNT + 1);
	if (mediumDict == NULL) {
		return false;
	}
	return true;
}
开发者ID:andyvand,项目名称:Intel-OS-X-LAN-Driver,代码行数:47,代码来源:AgereET131x.cpp

示例12: disableVmmDevInterrupts

bool org_virtualbox_VBoxGuest::disableVmmDevInterrupts(void)
{
    IOWorkLoop *pWorkLoop = (IOWorkLoop *)getWorkLoop();

    if (!pWorkLoop)
        return false;

    if (!m_pInterruptSrc)
        return false;

    m_pInterruptSrc->disable();
    pWorkLoop->removeEventSource(m_pInterruptSrc);
    m_pInterruptSrc->release();
    m_pInterruptSrc = NULL;

    return true;
}
开发者ID:bhanug,项目名称:virtualbox,代码行数:17,代码来源:VBoxGuest-darwin.cpp

示例13: DebugLog

bool BrcmPatchRAM::start(IOService *provider)
{
    DebugLog("start\n");

    if (!super::start(provider))
        return false;

    // place version/build info in ioreg properties RM,Build and RM,Version
    char buf[128];
    snprintf(buf, sizeof(buf), "%s %s", OSKextGetCurrentIdentifier(), OSKextGetCurrentVersionString());
    setProperty("RM,Version", buf);
#ifdef DEBUG
    setProperty("RM,Build", "Debug-" LOGNAME);
#else
    setProperty("RM,Build", "Release-" LOGNAME);
#endif

   // add interrupt source for delayed actions...
    IOWorkLoop* workLoop = getWorkLoop();
    if (!workLoop)
        return false;
    mWorkSource = IOInterruptEventSource::interruptEventSource(this, OSMemberFunctionCast(IOInterruptEventAction, this, &BrcmPatchRAM::processWorkQueue));
    if (!mWorkSource)
        return false;
    workLoop->addEventSource(mWorkSource);
    mWorkPending = 0;

    // add timer for firmware load in the case no re-probe after wake
    mTimer = IOTimerEventSource::timerEventSource(this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &BrcmPatchRAM::onTimerEvent));
    if (!mTimer)
    {
        workLoop->removeEventSource(mWorkSource);
        mWorkSource->release();
        mWorkSource = NULL;
        return false;
    }
    workLoop->addEventSource(mTimer);

    // register for power state notifications
    PMinit();
    registerPowerDriver(this, myTwoStates, 2);
    provider->joinPMtree(this);
    
    return true;
}
开发者ID:the-darkvoid,项目名称:BrcmPatchRAM,代码行数:45,代码来源:BrcmPatchRAM.cpp

示例14: OSDynamicCast

// Shut down the driver
void WirelessHIDDevice::handleStop(IOService *provider)
{
    WirelessDevice *device = OSDynamicCast(WirelessDevice, provider);

    if (device != NULL)
        device->RegisterWatcher(NULL, NULL, NULL);

    if (serialTimer != NULL) {
        serialTimer->cancelTimeout();
        IOWorkLoop *workloop = getWorkLoop();
        if (workloop != NULL)
            workloop->removeEventSource(serialTimer);
        serialTimer->release();
        serialTimer = NULL;
    }
    
    super::handleStop(provider);
}
开发者ID:Aerodynamic,项目名称:360Controller,代码行数:19,代码来源:WirelessHIDDevice.cpp

示例15: DbgLog

void ACPIBacklightPanel::stop( IOService * provider )
{
    DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);

    IOWorkLoop* workLoop = getWorkLoop();
    if (workLoop)
    {
        if (_workSource)
        {
            workLoop->removeEventSource(_workSource);
            _workSource->release();
            _workSource = NULL;
        }
        if (_smoothTimer)
        {
            workLoop->removeEventSource(_smoothTimer);
            _smoothTimer->release();
            _smoothTimer = NULL;
        }
        if (_cmdGate)
        {
            workLoop->removeEventSource(_cmdGate);
            _cmdGate->release();
            _cmdGate = NULL;
        }
    }
    _extended = false;

    if (_lock)
    {
        IORecursiveLockFree(_lock);
        _lock = NULL;
    }

#if 0
    OSSafeReleaseNULL(_provider);
#endif

    _backlightHandler = NULL;

    super::stop(provider);
}
开发者ID:chemschool,项目名称:OS-X-ACPI-Backlight,代码行数:42,代码来源:ACPIBacklight.cpp


注:本文中的IOWorkLoop类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。