bool IOFWWorkLoop::init( void ) { bool success = true; if( success ) { // create a unique lock group for this instance of the FireWire workloop // this helps elucidate lock statistics SInt32 count = OSIncrementAtomic( &sLockGroupCount ); char name[64]; snprintf( name, sizeof(name), "FireWire %d", (int)count ); fLockGroup = lck_grp_alloc_init( name, LCK_GRP_ATTR_NULL ); if( !fLockGroup ) { success = false; } } if( success ) { gateLock = IORecursiveLockAllocWithLockGroup( fLockGroup ); } if( success ) { fRemoveSourceDeferredSet = OSSet::withCapacity( 1 ); if( fRemoveSourceDeferredSet == NULL ) { success = false; } } if( success ) { success = IOWorkLoop::init(); } return success; }
bool SCSIParallelWorkLoop::InitWithLockGroupName ( const char * lockGroupName ) { bool result = false; fLockGroup = lck_grp_alloc_init ( lockGroupName, LCK_GRP_ATTR_NULL ); require_nonzero ( fLockGroup, ErrorExit ); // Allocate the gateLock before calling the super class. This allows // us to profile contention on our workloop lock. gateLock = IORecursiveLockAllocWithLockGroup ( fLockGroup ); result = super::init ( ); ErrorExit: return result; }