|
Mac Dev Center
Mac OS X Reference Library Drivers, Kernel, & Hardware: Kernel Device Drivers Kernel Framework Reference
|
IOLocks.h |
| Includes: |
<sys/appleapiopts.h> <IOKit/system.h> <IOKit/IOReturn.h> <IOKit/IOTypes.h> <libkern/locks.h> <machine/machine_routines.h> |
Use the links in the table of contents to the left to access the documentation.
Allocates and initializes a mutex.
Frees a mutex.
Accessor to a Mach mutex.
Lock a mutex.
Sleep with mutex unlock and relock
Attempt to lock a mutex.
Lock a mutex.
Attempt to lock a mutex.
Sleep with mutex unlock and relock
IOLockAlloc |
Allocates and initializes a mutex.
IOLock * IOLockAlloc( void );
Pointer to the allocated lock, or zero on failure.
Allocates a mutex in general purpose memory, and initializes it. Mutexes are general purpose blocking mutual exclusion locks, supplied by libkern/locks.h. This function may block and so should not be called from interrupt level or while a spin lock is held. IOLocks use the global IOKit lock group, IOLockGroup. To simplify kext debugging and lock-heat analysis, consider using lck_* locks with a per-driver lock group, as defined in kern/locks.h.
IOLockFree |
Frees a mutex.
void IOLockFree( IOLock *lock);
lockPointer to the allocated lock.
Frees a lock allocated with IOLockAlloc. Any blocked waiters will not be woken.
IOLockGetMachLock |
Accessor to a Mach mutex.
lck_mtx_t * IOLockGetMachLock( IOLock *lock);
lockPointer to the allocated lock.
Accessor to the Mach mutex.
IOLockLock_multideclaration_block |
Lock a mutex.
See Also:void lck_mtx_lock( IOLock *lock);
lockPointer to the allocated lock.
Lock the mutex. If the lock is held by any thread, block waiting for its unlock. This function may block and so should not be called from interrupt level or while a spin lock is held. Locking the mutex recursively from one thread will result in deadlock.
IOLockSleep |
Sleep with mutex unlock and relock
See Also:void lck_mtx_unlock( IOLock *lock) __DARWIN10_ALIAS( lck_mtx_unlock( IOLock * lock); #endif /* __i386__ */ #endif /* !IOLOCKS_INLINE */ int IOLockSleep( IOLock * lock, void *event, UInt32 interType); int IOLockSleepDeadline( IOLock * lock, void *event, AbsoluteTime deadline, UInt32 interType); void IOLockWakeup( IOLock * lock, void *event, bool oneThread); #ifdef __APPLE_API_OBSOLETE /* The following API is deprecated */ typedef enum
lockPointer to the allocated lock.
lockPointer to the locked lock.
eventThe event to sleep on.
interTypeHow can the sleep be interrupted.
The wait-result value indicating how the thread was awakened.
Prepare to sleep,unlock the mutex, and re-acquire it on wakeup. Results are undefined if the caller has not locked the mutex. This function may block and so should not be called from interrupt level or while a spin lock is held.
IOLockTryLock_multideclaration_block |
Attempt to lock a mutex.
See Also:boolean_t lck_mtx_try_lock( IOLock *lock);
lockPointer to the allocated lock.
Lock the mutex if it is currently unlocked, and return true. If the lock is held by any thread, return false.
lck_mtx_lock |
Lock a mutex.
See Also:void lck_mtx_lock( IOLock *lock);
lockPointer to the allocated lock.
Lock the mutex. If the lock is held by any thread, block waiting for its unlock. This function may block and so should not be called from interrupt level or while a spin lock is held. Locking the mutex recursively from one thread will result in deadlock.
lck_mtx_try_lock |
Attempt to lock a mutex.
See Also:boolean_t lck_mtx_try_lock( IOLock *lock);
lockPointer to the allocated lock.
Lock the mutex if it is currently unlocked, and return true. If the lock is held by any thread, return false.
lck_mtx_unlock |
Sleep with mutex unlock and relock
See Also:void lck_mtx_unlock( IOLock *lock) __DARWIN10_ALIAS( lck_mtx_unlock( IOLock * lock); #endif /* __i386__ */ #endif /* !IOLOCKS_INLINE */ int IOLockSleep( IOLock * lock, void *event, UInt32 interType); int IOLockSleepDeadline( IOLock * lock, void *event, AbsoluteTime deadline, UInt32 interType); void IOLockWakeup( IOLock * lock, void *event, bool oneThread); #ifdef __APPLE_API_OBSOLETE /* The following API is deprecated */ typedef enum
lockPointer to the allocated lock.
lockPointer to the locked lock.
eventThe event to sleep on.
interTypeHow can the sleep be interrupted.
Prepare to sleep,unlock the mutex, and re-acquire it on wakeup. Results are undefined if the caller has not locked the mutex. This function may block and so should not be called from interrupt level or while a spin lock is held.
IOLockGroup |
extern lck_grp_t *IOLockGroup;
Global lock group used by all IOKit locks. To simplify kext debugging and lock-heat analysis, consider using lck_* locks with a per-driver lock group, as defined in kern/locks.h.
Lock a mutex.
Attempt to lock a mutex.
Sleep with mutex unlock and relock
IOLockLock |
Lock a mutex.
See Also:#ifdef IOLOCKS_INLINE #define IOLockLock(l) lck_mtx_lock(l) #else void lck_mtx_lock( IOLock *lock); #endif /* !IOLOCKS_INLINE */
lockPointer to the allocated lock.
Lock the mutex. If the lock is held by any thread, block waiting for its unlock. This function may block and so should not be called from interrupt level or while a spin lock is held. Locking the mutex recursively from one thread will result in deadlock.
IOLockTryLock |
Attempt to lock a mutex.
See Also:#ifdef IOLOCKS_INLINE #define IOLockTryLock(l) lck_mtx_try_lock(l) #else boolean_t lck_mtx_try_lock( IOLock *lock); #endif /* !IOLOCKS_INLINE */
lockPointer to the allocated lock.
True if the mutex was unlocked and is now locked by the caller, otherwise false.
Lock the mutex if it is currently unlocked, and return true. If the lock is held by any thread, return false.
IOLockUnlock |
Sleep with mutex unlock and relock
See Also:#ifdef IOLOCKS_INLINE #define IOLockUnlock(l) lck_mtx_unlock(l) #else #if defined(__i386__) void lck_mtx_unlock( IOLock *lock) __DARWIN10_ALIAS( lck_mtx_unlock( IOLock * lock); #endif /* __i386__ */ #endif /* !IOLOCKS_INLINE */ int IOLockSleep( IOLock * lock, void *event, UInt32 interType); int IOLockSleepDeadline( IOLock * lock, void *event, AbsoluteTime deadline, UInt32 interType); void IOLockWakeup( IOLock * lock, void *event, bool oneThread); #ifdef __APPLE_API_OBSOLETE /* The following API is deprecated */ typedef enum #endif
IOLockSleeplockPointer to the allocated lock.
The wait-result value indicating how the thread was awakened.
Prepare to sleep,unlock the mutex, and re-acquire it on wakeup. Results are undefined if the caller has not locked the mutex. This function may block and so should not be called from interrupt level or while a spin lock is held.
Last Updated: 2009-10-14