本文整理汇总了C++中IOLockUnlock函数的典型用法代码示例。如果您正苦于以下问题:C++ IOLockUnlock函数的具体用法?C++ IOLockUnlock怎么用?C++ IOLockUnlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IOLockUnlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IOLockLock
void AppleGPIO::unregisterWithParent(void)
{
// grab the mutex
IOLockLock(fAmRegisteredLock);
if (!fAmRegistered)
{
DLOG("AppleGPIO::unregisterWithParent not registered!!\n");
IOLockUnlock(fAmRegisteredLock);
return;
}
if (fParent->callPlatformFunction(kSymGPIOParentUnregister, false,
(void *)fGPIOID, (void *)getProvider(),
(void *)&sGPIOEventOccured, (void *)this) == kIOReturnSuccess)
{
fAmRegistered = false;
}
else
{
DLOG("AppleGPIO::unregisterWithParent failed to unregister\n");
}
// release the mutex
IOLockUnlock(fAmRegisteredLock);
}
示例2: IOLockLock
void
SCSIPressurePathManager::ExecuteCommand ( SCSITaskIdentifier request )
{
SCSITargetDevicePath * path = NULL;
PortBandwidthGlobals * bw = NULL;
UInt32 numPaths = 0;
IOLockLock ( fLock );
numPaths = fPathSet->getCount ( );
if ( numPaths == 0 )
{
IOLockUnlock ( fLock );
PathTaskCallback ( request );
return;
}
bw = PortBandwidthGlobals::GetSharedInstance ( );
path = bw->AllocateBandwidth ( fPathSet, GetRequestedDataTransferCount ( request ) );
IOLockUnlock ( fLock );
SetPathLayerReference ( request, ( void * ) path );
path->GetInterface ( )->ExecuteCommand ( request );
}
开发者ID:unofficial-opensource-apple,项目名称:IOSCSIArchitectureModelFamily,代码行数:30,代码来源:SCSIPathManagers.cpp
示例3: 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;
}
示例4: 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
示例5: 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();
}
}
示例6: IOLockLock
IOReturn SPFramebuffer::disable() {
IOLockLock(lock);
if (!isEnabled) {
IOLockUnlock(lock);
return kIOReturnNotOpen;
}
isEnabled = false;
connectChangeInterrupt(this, NULL);
IOLockUnlock(lock);
return kIOReturnSuccess;
}
示例7: 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;
}
示例8: free
static void free(IOLock*& lock) {
IOLockLock(lock);
IOLock* tmplock = lock;
lock = NULL;
IOLockUnlock(tmplock);
IOLockFree(tmplock);
}
示例9: IOLockLock
void IOHIKeyboard::free()
// Description: Go Away. Be careful when freeing the lock.
{
IOLock * lock = NULL;
if ( _deviceLock )
{
lock = _deviceLock;
IOLockLock( lock);
_deviceLock = NULL;
}
if ( _keyMap ) {
_keyMap->release();
}
if( _keyState )
IOFree( _keyState, _keyStateSize);
// RY: MENTAL NOTE Do this last
if ( lock )
{
IOLockUnlock( lock);
IOLockFree( lock);
}
super::free();
}
示例10: IOLockLock
void IOAccelerationUserClient::stop( IOService * provider )
{
IOAccelIDRecord * record;
IOLockLock(gLock);
while (!queue_empty( &fTaskList ))
{
queue_remove_first( &fTaskList,
record,
IOAccelIDRecord *,
task_link );
if (--record->retain)
record->task_link.next = 0;
else
{
queue_remove(&gGlobalList,
record,
IOAccelIDRecord *,
glob_link);
gTotalCount--;
IODelete(record, IOAccelIDRecord, 1);
}
}
IOLockUnlock(gLock);
super::stop( provider );
}
示例11: IOLockLock
void
IOFWUserAsyncStreamListener::deactivate()
{
IOFWAsyncStreamListener::TurnOffNotification() ;
IOLockLock(fLock) ;
fBufferAvailable = 0 ; // zzz do we need locking here to protect our data?
fLastReadHeader = NULL ;
IOFWPacketHeader* firstHeader = fLastWrittenHeader ;
IOFWPacketHeader* tempHeader ;
if (fLastWrittenHeader)
{
while (fLastWrittenHeader->CommonHeader.next != firstHeader)
{
tempHeader = fLastWrittenHeader->CommonHeader.next ;
delete fLastWrittenHeader ;
fLastWrittenHeader = tempHeader ;
}
}
fWaitingForUserCompletion = false ;
IOLockUnlock(fLock) ;
}
示例12: IOLockLock
int
Rules::DeactivateRule(UInt32 ruleId)
{
int result = -1;
IOLockLock(lock);
Rule* workRule = this->root;
while (workRule)
{
if(workRule->id == ruleId)
{
if(workRule->state == RuleStateInactive)
{
workRule->state = RuleStateActive;
clock_get_uptime(&lastChangedTime);
result = 0;
}
else
{
result = 1;//alredy inactive
}
break;
}
workRule = workRule->next;
}
IOLockUnlock(lock);
return result;
}
示例13: IOLockLock
/******************************************************************************
* ACPIDebug::PrintTraces
******************************************************************************/
void ACPIDebug::PrintTraces()
{
IOLockLock(m_pLock);
for (;;)
{
// see if there are any trace items in the RING
UInt32 count = 0;
if (kIOReturnSuccess != m_pDevice->evaluateInteger("COUN", &count))
{
IOLog("ACPIDebug: evaluateObject of COUN method failed\n");
break;
}
if (!count)
break;
// gather the next item from RING and print it
OSObject* debug;
if (kIOReturnSuccess == m_pDevice->evaluateObject("FTCH", &debug) &&
NULL != debug)
{
static char buf[2048];
// got a valid object, format and print it...
FormatDebugString(debug, buf, sizeof(buf)/sizeof(buf[0]));
IOLog("ACPIDebug: %s\n", buf);
debug->release();
}
}
IOLockUnlock(m_pLock);
}
示例14: IOLockLock
void BrcmPatchRAM::scheduleWork(unsigned int newWork)
{
IOLockLock(mWorkLock);
mWorkPending |= newWork;
mWorkSource->interruptOccurred(0, 0, 0);
IOLockUnlock(mWorkLock);
}
示例15: IOLockLock
/* static */
void
OSMetaClass::printInstanceCounts()
{
OSCollectionIterator * classes;
OSSymbol * className;
OSMetaClass * meta;
IOLockLock(sAllClassesLock);
classes = OSCollectionIterator::withCollection(sAllClassesDict);
assert(classes);
while( (className = (OSSymbol *)classes->getNextObject())) {
meta = (OSMetaClass *)sAllClassesDict->getObject(className);
assert(meta);
printf("%24s count: %03d x 0x%03x = 0x%06x\n",
className->getCStringNoCopy(),
meta->getInstanceCount(),
meta->getClassSize(),
meta->getInstanceCount() * meta->getClassSize() );
}
printf("\n");
classes->release();
IOLockUnlock(sAllClassesLock);
return;
}