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);
lock
Pointer 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);
lock
Pointer to the allocated lock.
Accessor to the Mach mutex.
IOLockLock_multideclaration_block |
Lock a mutex.
void lck_mtx_lock( IOLock *lock);
lock
Pointer 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.
See Also
IOLockSleep |
Sleep with mutex unlock and relock
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
lock
Pointer to the allocated lock.
lock
Pointer to the locked lock.
event
The event to sleep on.
interType
How 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.
See Also
IOLockTryLock_multideclaration_block |
Attempt to lock a mutex.
boolean_t lck_mtx_try_lock( IOLock *lock);
lock
Pointer 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.
See Also
lck_mtx_lock |
Lock a mutex.
void lck_mtx_lock( IOLock *lock);
lock
Pointer 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.
See Also
lck_mtx_try_lock |
Attempt to lock a mutex.
boolean_t lck_mtx_try_lock( IOLock *lock);
lock
Pointer 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.
See Also
lck_mtx_unlock |
Sleep with mutex unlock and relock
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
lock
Pointer to the allocated lock.
lock
Pointer to the locked lock.
event
The event to sleep on.
interType
How 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.
See Also
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.
#ifdef IOLOCKS_INLINE #define IOLockLock(l) lck_mtx_lock(l) #else void lck_mtx_lock( IOLock *lock); #endif /* !IOLOCKS_INLINE */
lock
Pointer 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.
See Also
IOLockTryLock |
Attempt to lock a mutex.
#ifdef IOLOCKS_INLINE #define IOLockTryLock(l) lck_mtx_try_lock(l) #else boolean_t lck_mtx_try_lock( IOLock *lock); #endif /* !IOLOCKS_INLINE */
lock
Pointer 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.
See Also
IOLockUnlock |
Sleep with mutex unlock and relock
#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
IOLockSleep
lock
Pointer 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.
See Also
Last Updated: 2010-07-29