• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IOLockLock函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: LOG

errno_t	IOWebFilterClass::tl_data_in_func(void *cookie, socket_t so,
                                          const struct sockaddr *from, mbuf_t *data, mbuf_t *control,
                                          sflt_data_flag_t flags)
{
    SocketTracker *tracker = (SocketTracker*)cookie;

//    __asm__("int3");

    LOG(LOG_DEBUG, "I am in, %s, magic=%ld", tracker->proc_name, tracker->magic);

    if(tracker==NULL || data==NULL || (tracker->magic&(kSocketTrackerInvalid|kSocketTrackerDetach))!=0)
    {
        LOG(LOG_DEBUG, "in return process");
        return 0;
    }
    if(tracker->lock==NULL)
    {
        tracker->magic=kSocketTrackerInvalid;
        return 0;
    }

    IOLockLock(tracker->lock);
    mbuf_t head = *data;
    uint64_t len=0;

    if(head==NULL)
    {
        tracker->magic=kSocketTrackerInvalid;
        IOLockUnlock(tracker->lock);
        return 0;
    }

    while(head)
    {
        len += mbuf_len(head);
        head = mbuf_next(head);
    }

    if(len>sizeof(tracker->request_meg)-1)
    {
        tracker->magic=kSocketTrackerInvalid;
        IOLockUnlock(tracker->lock);
        return 0;
    }
    bzero(tracker->request_meg, sizeof(tracker->request_meg));
    mbuf_copydata(*data, 0, len, tracker->request_meg);

    //todo: sync to shared memory, record a new request
    if(_queue)
    {
        LOG(LOG_DEBUG, "enter queue");
        _queue->EnqueueTracker((DataArgs*)tracker);
    }

    IOLockUnlock(tracker->lock);
    return 0;
}
开发者ID:heavilessrose,项目名称:IOFireWall,代码行数:57,代码来源:IOWebFilter.cpp


示例2: STATUS_LOG

void
SCSIPressurePathManager::ActivatePath ( IOSCSIProtocolServices * interface )
{
	
	bool					result 	= false;
	SCSITargetDevicePath *	path	= NULL;
	
	STATUS_LOG ( ( "SCSIPressurePathManager::ActivatePath\n" ) );
	
	require_nonzero ( interface, ErrorExit );
	
	IOLockLock ( fLock );
	
	result = fInactivePathSet->member ( interface );
	if ( result == true )
	{
		
		path = fInactivePathSet->getObjectWithInterface ( interface );
		if ( path != NULL )
		{
			
			path->retain ( );
			path->Activate ( );
			fInactivePathSet->removeObject ( interface );
			fPathSet->setObject ( path );
			path->release ( );
			path = NULL;
			
		}
		
	}
	
	else
	{
		
		result = fPathSet->member ( interface );
		if ( result == false )
		{
			
			IOLockUnlock ( fLock );
			AddPath ( interface );
			goto Exit;
			
		}
		
	}
	
	IOLockUnlock ( fLock );
	
	
ErrorExit:
Exit:
	
	
	return;
	
}
开发者ID:unofficial-opensource-apple,项目名称:IOSCSIArchitectureModelFamily,代码行数:57,代码来源:SCSIPathManagers.cpp


示例3: assert

//
// false is returned when there are no entries left,
// the header of the retrurned enrty must not be changed
// and the entry must be provided as a parameter for 
// dequeueEntry when the entry is no longer needed
//
bool DldIODataQueue::dequeueDataInPlace( __out DldIODataQueueEntry** inPlaceEntry )
{
    DldIODataQueueEntry *  entry           = 0;
    
    assert( dataQueue );
    
    IOLockLock( this->lock );
    {// start of the lock
        
        UInt32                 newHeadOffset = 0;

        
        if( dataQueue->validDataHead != dataQueue->validDataTail ){
            
            DldIODataQueueEntry*   head;
            UInt32                 headOffset;
            
            headOffset = dataQueue->validDataHead;
            head = (DldIODataQueueEntry *)((char *)dataQueue->queue + headOffset);
            
            //
            // we wraped around to beginning, so read from there
            // either there was not even room for the header
            //
            if( (dataQueue->head +  DLD_DATA_QUEUE_ENTRY_HEADER_SIZE > dataQueue->queueSize) ||
               // or there was room for the header, but not for the data
               ((dataQueue->head + head->dataSize + DLD_DATA_QUEUE_ENTRY_HEADER_SIZE) > dataQueue->queueSize)) {
                
                entry = dataQueue->queue;
                newHeadOffset = entry->dataSize + DLD_DATA_QUEUE_ENTRY_HEADER_SIZE;
                // else it is at the end
                
            } else {
                
                entry = head;
                newHeadOffset = headOffset + entry->dataSize + DLD_DATA_QUEUE_ENTRY_HEADER_SIZE;
            }
            
        }// else if( dataQueue->validDataHead != dataQueue->validDataTail )
        

        if (entry) {
            
            assert( DLD_QUEUE_SIGNATURE == entry->signature );
            assert( false == entry->intermediate );
            
            *inPlaceEntry = entry;
            dataQueue->validDataHead = newHeadOffset;
            
        }
        
    }// end of the lock
    IOLockUnlock( this->lock );
    
    return ( NULL != entry );
}
开发者ID:antekone,项目名称:MacOSX-Kernel-Filter,代码行数:62,代码来源:DldIODataQueue.cpp


示例4: IOLockLock

IOReturn AppleRAIDMemoryDescriptor::complete(IODirection forDirection)
{
    IOReturn result;
    
    IOLockLock(mdMemoryDescriptorLock);
    result = mdMemoryDescriptor->complete(forDirection);
    IOLockUnlock(mdMemoryDescriptorLock);
    
    return result;
}
开发者ID:JeremyAgost,项目名称:osx-10.9,代码行数:10,代码来源:AppleRAIDMemoryDescriptor.cpp


示例5: IOLockLock

void IOHIDEventQueue::setOptions(IOHIDQueueOptionsType flags) 
{
    if ( _lock )
        IOLockLock(_lock);

	_options = flags;

    if ( _lock )
        IOLockUnlock(_lock);
}
开发者ID:wzw19890321,项目名称:IOHIDFamily,代码行数:10,代码来源:IOHIDEventQueue.cpp


示例6: kperf_pet_thread_wait

/* wait for the pet thread to finish a run */
void
kperf_pet_thread_wait(void)
{
	if( !pet_lock )
		return;

	/* acquire the lock to ensure the thread is parked. */
	IOLockLock(pet_lock);
	IOLockUnlock(pet_lock);
}
开发者ID:Apple-FOSS-Mirror,项目名称:xnu,代码行数:11,代码来源:pet.c


示例7: GetKeyboardReservedStructEventForService

void IOHIKeyboard::dispatchKeyboardEvent(unsigned int keyCode,
			 /* direction */ bool         goingDown,
                         /* timeStamp */ AbsoluteTime time)
// Description:	This method is the heart of event dispatching. The overlying
//		subclass invokes this method with each event. We then
//		get the event xlated and dispatched using a _keyMap instance.
//		The event structure passed in by reference should not be freed.
{
    IOHIKeyboardMapper	* theKeyMap;
    KeyboardReserved *tempReservedStruct = GetKeyboardReservedStructEventForService(this); 
	
    IOLockLock( _deviceLock);

    _lastEventTime = time;

    // Post the event to the HID Manager
    if (tempReservedStruct)
    {
        if (tempReservedStruct->keyboardNub )
        {
            tempReservedStruct->keyboardNub->postKeyboardEvent(keyCode, goingDown);
        }
        
        if (tempReservedStruct->isSeized)
        {
            IOLockUnlock( _deviceLock);
            return;
        }
    }


    if (tempReservedStruct) tempReservedStruct->dispatchEventCalled = true;

    if (_keyMap)  _keyMap->translateKeyCode(keyCode,
			  /* direction */ goingDown,
			  /* keyBits */   _keyState);
			  
    // remember the keymap while we hold the lock
    theKeyMap = _keyMap;

    if (tempReservedStruct) tempReservedStruct->dispatchEventCalled = false;
	
    IOLockUnlock( _deviceLock);
	
	// outside the lock (because of possible recursion), give the
	// keymap a chance to do some post processing
	// since it is possible we will be entered reentrantly and 
	// release the keymap, we will add a retain here.
    if (theKeyMap)
	{
		theKeyMap->retain();
		theKeyMap->keyEventPostProcess();
		theKeyMap->release();
	}
}
开发者ID:MomandDad,项目名称:netbook-installer,代码行数:55,代码来源:IOHIKeyboard.cpp


示例8: IOLockLock

OSMetaClass::~OSMetaClass()
{
    OSKext * myKext = (OSKext *)reserved; // do not release

   /* Hack alert: 'className' is a C string during early C++ init, and
    * is converted to a real OSSymbol only when we record the OSKext in
    * OSMetaClass::postModLoad(). So only do this bit if we have an OSKext.
    * We can't safely cast or check 'className'.
    *
    * Also, release className *after* calling into the kext,
    * as removeClass() may access className.
    */
    IOLockLock(sAllClassesLock);
    if (sAllClassesDict) {
        if (myKext) {
            sAllClassesDict->removeObject(className);
        } else {
            sAllClassesDict->removeObject((char *)className);
        }
    }
    IOLockUnlock(sAllClassesLock);
    
    if (myKext) {
        if (myKext->removeClass(this) != kOSReturnSuccess) {
            // xxx - what can we do?
        }
        className->release();
    }

    // sStalledClassesLock taken in preModLoad
    if (sStalled) {
        unsigned int i;
        
       /* First pass find class in stalled list. If we find it that means
        * we started C++ init with constructors but now we're tearing down
        * because of some failure.
        */
        for (i = 0; i < sStalled->count; i++) {
            if (this == sStalled->classes[i]) {
                break;
            }
        }
        
       /* Remove this metaclass from the stalled list so postModLoad() doesn't
        * try to register it.
        */
        if (i < sStalled->count) {
            sStalled->count--;
            if (i < sStalled->count) {
                memmove(&sStalled->classes[i], &sStalled->classes[i+1],
                    (sStalled->count - i) * sizeof(OSMetaClass *));
            }
        }
    }
}
开发者ID:Prajna,项目名称:xnu,代码行数:55,代码来源:OSMetaClass.cpp


示例9: IOLockLock

IOReturn SPFramebuffer::disable() {
    IOLockLock(lock);
    if (!isEnabled) {
        IOLockUnlock(lock);
        return kIOReturnNotOpen;
    }
    isEnabled = false;
    connectChangeInterrupt(this, NULL);
    IOLockUnlock(lock);
    return kIOReturnSuccess;
}
开发者ID:unixpickle,项目名称:ScreenPear,代码行数:11,代码来源:SPFramebuffer.cpp


示例10: IOLockLock

bool AppleGPIO::amRegistered(void)
{
	bool result;

	IOLockLock(fAmRegisteredLock);

	result = fAmRegistered;

	IOLockUnlock(fAmRegisteredLock);

	return(result);
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:12,代码来源:AppleGPIO.cpp


示例11: IOLockLock

IODataQueue *
IOHIDEventSystemUserClient::copyDataQueueWithID(UInt32 queueID)
{
	IODataQueue * eventQueue;

	IOLockLock(gAllUserQueuesLock);
	eventQueue = OSDynamicCast(IODataQueue, gAllUserQueues->getObject(queueID - kIOHIDEventSystemUserQueueID));
	if (eventQueue)
		eventQueue->retain();
	IOLockUnlock(gAllUserQueuesLock);

	return (eventQueue);
}
开发者ID:wzw19890321,项目名称:IOHIDFamily,代码行数:13,代码来源:IOHIDUserClient.cpp


示例12: IOLockLock

void GlobalLock::terminate(void) {
  if (!lock_) return;

  IOLockLock(lock_);
  IOLock* tmp = lock_;
  lock_ = NULL;
  IOLockUnlock(tmp);

  // roughly sleep:
  IOSleep(200);

  IOLockFree(tmp);
}
开发者ID:andyvand,项目名称:Seil,代码行数:13,代码来源:GlobalLock.cpp


示例13: IOLockLock

void AppleNForceATARoot::pciConfigWrite32( UInt8 offset, UInt32 data, UInt32 mask )
{
    UInt8 u32;

    IOLockLock( fPCILock );

    u32 = fProvider->configRead32( offset );
    u32 &= ~mask;
    u32 |= (mask & data);
    fProvider->configWrite32( offset, u32 );

    IOLockUnlock( fPCILock );
}
开发者ID:BackupTheBerlios,项目名称:nforce4sata-svn,代码行数:13,代码来源:AppleNForceATARoot.cpp


示例14: IOLockLock

IOReturn IOPlatformExpert::registerInterruptController(OSSymbol *name, IOInterruptController *interruptController)
{
  IOLockLock(gIOInterruptControllersLock);
  
  gIOInterruptControllers->setObject(name, interruptController);
  
  IOLockWakeup(gIOInterruptControllersLock,
		gIOInterruptControllers, /* one-thread */ false);

  IOLockUnlock(gIOInterruptControllersLock);
  
  return kIOReturnSuccess;
}
开发者ID:OpenDarwin-CVS,项目名称:SEDarwin,代码行数:13,代码来源:IOPlatformExpert.cpp


示例15: IOLockLock

IOReturn IOSharedInterruptController::unregisterInterrupt(IOService *nub,
							  int source)
{
  IOInterruptVectorNumber vectorNumber;
  IOInterruptVector *vector;
  IOInterruptState  interruptState;

  for (vectorNumber = 0; vectorNumber < kIOSharedInterruptControllerDefaultVectors; vectorNumber++) {
    vector = &vectors[vectorNumber];

    // Get the lock for this vector.
    IOLockLock(vector->interruptLock);

    // Return success if it is not already registered
    if (!vector->interruptRegistered
     || (vector->nub != nub) || (vector->source != source)) {
        IOLockUnlock(vector->interruptLock);
        continue;
    }

    // Soft disable the source and the controller too.
    disableInterrupt(nub, source);

    // Clear all the storage for the vector except for interruptLock.
    vector->interruptActive = 0;
    vector->interruptDisabledSoft = 0;
    vector->interruptDisabledHard = 0;
    vector->interruptRegistered = 0;
    vector->nub = 0;
    vector->source = 0;
    vector->handler = 0;
    vector->target = 0;
    vector->refCon = 0;

    interruptState = IOSimpleLockLockDisableInterrupt(controllerLock);
    vectorsRegistered--;
    IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);

    // Move along to the next one.
    IOLockUnlock(vector->interruptLock);
  }

  // Re-enable the controller if all vectors are enabled.
  if (vectorsEnabled == vectorsRegistered) {
    controllerDisabled = 0;
    provider->enableInterrupt(0);
  }

  return kIOReturnSuccess;
}
开发者ID:aglab2,项目名称:darwin-xnu,代码行数:50,代码来源:IOInterruptController.cpp


示例16: kperf_pet_timer_config

/* make sure the thread takes a new period value */
void
kperf_pet_timer_config( unsigned timerid, unsigned actionid )
{
	/* hold the lock so pet thread doesn't run while we do this */
	IOLockLock(pet_lock);

	BUF_INFO1(PERF_PET_THREAD, 3);

	/* set values */
	pet_timerid = timerid;
	pet_actionid = actionid;

	/* done */
	IOLockUnlock(pet_lock);
}
开发者ID:CptFrazz,项目名称:xnu,代码行数:16,代码来源:pet.c


示例17: IOLockLock

void AppleIntelPIIXATARoot::pciConfigWrite16( UInt8  offset,
                                              UInt16 data,
                                              UInt16 mask )
{
    UInt16 u16;

    IOLockLock( _pciConfigLock );

    u16 = _provider->configRead16( offset );
    u16 &= ~mask;
    u16 |= (mask & data);
    _provider->configWrite16( offset, u16 );

    IOLockUnlock( _pciConfigLock );
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:15,代码来源:AppleIntelPIIXATARoot.cpp


示例18: IOLockLock

bool IOHIKeyboard::resetKeyboard()
// Description:	Reset the keymapping to the default value and reconfigure
//		the keyboards.
{
    const unsigned char *defaultKeymap;
    UInt32	defaultKeymapLength;

    IOLockLock( _deviceLock);

    if ( _keyMap )
		_keyMap->release();

    // Set up default keymapping.
    defaultKeymap = defaultKeymapOfLength(&defaultKeymapLength);

    _keyMap = IOHIKeyboardMapper::keyboardMapper( this,
                                                  defaultKeymap,
                                                  defaultKeymapLength,
                                                  false );

    if (_keyMap)
    {
		// point the new keymap to the IOHIDSystem, so it can set properties in it
		_keyMap->setKeyboardTarget((IOService *) _keyboardEventTarget);

        clock_interval_to_absolutetime_interval( EV_DEFAULTKEYREPEAT,
                                                 kNanosecondScale, &_keyRepeat);
        clock_interval_to_absolutetime_interval( EV_DEFAULTINITIALREPEAT,
                                                 kNanosecondScale, &_initialKeyRepeat);
    }

    updateProperties();
    
    _interfaceType = interfaceID();
    _deviceType    = deviceType();
    _guid	   = getGUID();

    if (getProperty("HIDKeyboardKeysDefined"))
    {
        KeyboardReserved * reservedStruct = GetKeyboardReservedStructEventForService(this);
        
        if ( reservedStruct && !reservedStruct->keyboardNub)
            reservedStruct->keyboardNub = IOHIDKeyboardDevice::newKeyboardDeviceAndStart(this);
    }

    IOLockUnlock( _deviceLock);
    return (_keyMap) ? true : false;
}
开发者ID:MomandDad,项目名称:netbook-installer,代码行数:48,代码来源:IOHIKeyboard.cpp


示例19: IOLockLock

SCSIServiceResponse
SCSIPressurePathManager::LogicalUnitReset ( SCSILogicalUnitNumber theLogicalUnit )
{
	
	SCSITargetDevicePath *	path = NULL;
	
	IOLockLock ( fLock );
	path = fPathSet->getAnyObject ( );
	IOLockUnlock ( fLock );
	
	if ( path == NULL )
		return kSCSIServiceResponse_FUNCTION_REJECTED;
	
	return path->GetInterface ( )->LogicalUnitReset ( theLogicalUnit );
	
}
开发者ID:unofficial-opensource-apple,项目名称:IOSCSIArchitectureModelFamily,代码行数:16,代码来源:SCSIPathManagers.cpp


示例20: return

UInt32
IOHIDEventSystemUserClient::createIDForDataQueue(IODataQueue * eventQueue)
{
	UInt32 queueIdx;

	if (!eventQueue)
		return (0);

	IOLockLock(gAllUserQueuesLock);
	for (queueIdx = 0;
		  OSDynamicCast(IODataQueue, gAllUserQueues->getObject(queueIdx));
		  queueIdx++) {}
	gAllUserQueues->setObject(queueIdx, eventQueue);
	IOLockUnlock(gAllUserQueuesLock);

	return (queueIdx + kIOHIDEventSystemUserQueueID);
}
开发者ID:wzw19890321,项目名称:IOHIDFamily,代码行数:17,代码来源:IOHIDUserClient.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IOLockUnlock函数代码示例发布时间:2022-05-30
下一篇:
C++ IOLOG_ERROR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap