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


C++ IOLockLock函数代码示例

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


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


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