• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/xnu-2422.115.4/iokit/IOKit/

Lines Matching refs:lock

54     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.
63 * Mutex lock operations
75 @discussion 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.
76 @result Pointer to the allocated lock, or zero on failure. */
82 @discussion Frees a lock allocated with IOLockAlloc. Mutex should be unlocked with no waiters.
83 @param lock Pointer to the allocated lock. */
85 void IOLockFree( IOLock * lock);
90 @param lock Pointer to the allocated lock. */
92 lck_mtx_t * IOLockGetMachLock( IOLock * lock);
96 @discussion 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.
97 @param lock Pointer to the allocated lock. */
102 void IOLockLock( IOLock * lock);
106 @abstract Attempt to lock a mutex.
107 @discussion Lock the mutex if it is currently unlocked, and return true. If the lock is held by any thread, return false.
108 @param lock Pointer to the allocated lock.
114 boolean_t IOLockTryLock( IOLock * lock);
119 @discussion Unlock the mutex and wake any blocked waiters. 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.
120 @param lock Pointer to the allocated lock. */
125 void IOLockUnlock( IOLock * lock);
130 @discussion 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.
131 @param lock Pointer to the locked lock.
135 int IOLockSleep( IOLock * lock, void *event, UInt32 interType);
137 int IOLockSleepDeadline( IOLock * lock, void *event,
140 void IOLockWakeup(IOLock * lock, void *event, bool oneThread);
151 void IOLockInitWithState( IOLock * lock, IOLockState state);
154 static __inline__ void IOTakeLock( IOLock * lock) { IOLockLock(lock); }
155 static __inline__ boolean_t IOTryLock( IOLock * lock) { return(IOLockTryLock(lock)); }
156 static __inline__ void IOUnlock( IOLock * lock) { IOLockUnlock(lock); }
161 * Recursive lock operations
167 @abstract Allocates and initializes an recursive lock.
168 @discussion Allocates a recursive lock in general purpose memory, and initializes it. Recursive locks function identically to mutexes but allow one thread to lock more than once, with balanced unlocks. IORecursiveLocks 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.
169 @result Pointer to the allocated lock, or zero on failure. */
174 @abstract Frees a recursive lock.
175 @discussion Frees a lock allocated with IORecursiveLockAlloc. Lock should be unlocked with no waiters.
176 @param lock Pointer to the allocated lock. */
178 void IORecursiveLockFree( IORecursiveLock * lock);
183 @param lock Pointer to the allocated lock. */
185 lck_mtx_t * IORecursiveLockGetMachLock( IORecursiveLock * lock);
188 @abstract Lock a recursive lock.
189 @discussion Lock the recursive lock. If the lock is held by another 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. The lock may be taken recursively by the same thread, with a balanced number of calls to IORecursiveLockUnlock.
190 @param lock Pointer to the allocated lock. */
192 void IORecursiveLockLock( IORecursiveLock * lock);
195 @abstract Attempt to lock a recursive lock.
196 @discussion Lock the lock if it is currently unlocked, or held by the calling thread, and return true. If the lock is held by another thread, return false. Successful calls to IORecursiveLockTryLock should be balanced with calls to IORecursiveLockUnlock.
197 @param lock Pointer to the allocated lock.
198 @result True if the lock is now locked by the caller, otherwise false. */
200 boolean_t IORecursiveLockTryLock( IORecursiveLock * lock);
203 @abstract Unlock a recursive lock.
204 @discussion Undo one call to IORecursiveLockLock, if the lock is now unlocked wake any blocked waiters. Results are undefined if the caller does not balance calls to IORecursiveLockLock with IORecursiveLockUnlock. This function may block and so should not be called from interrupt level or while a spin lock is held.
205 @param lock Pointer to the allocated lock. */
207 void IORecursiveLockUnlock( IORecursiveLock * lock);
210 @abstract Check if a recursive lock is held by the calling thread.
211 @discussion If the lock is held by the calling thread, return true, otherwise the lock is unlocked, or held by another thread and false is returned.
212 @param lock Pointer to the allocated lock.
213 @result True if the calling thread holds the lock otherwise false. */
215 boolean_t IORecursiveLockHaveLock( const IORecursiveLock * lock);
225 * Complex (read/write) lock operations
235 @abstract Allocates and initializes a read/write lock.
236 @discussion Allocates and initializes a read/write lock in general purpose memory. Read/write locks provide for multiple readers, one exclusive writer, and are 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. IORWLocks 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.
237 @result Pointer to the allocated lock, or zero on failure. */
242 @abstract Frees a read/write lock.
243 @discussion Frees a lock allocated with IORWLockAlloc. Lock should be unlocked with no waiters.
244 @param lock Pointer to the allocated lock. */
246 void IORWLockFree( IORWLock * lock);
249 @abstract Accessor to a Mach read/write lock.
250 @discussion Accessor to the Mach read/write lock.
251 @param lock Pointer to the allocated lock. */
253 lck_rw_t * IORWLockGetMachLock( IORWLock * lock);
256 @abstract Lock a read/write lock for read.
257 @discussion Lock the lock for read, allowing multiple readers when there are no writers. If the lock is held for write, 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 lock recursively from one thread, for read or write, can result in deadlock.
258 @param lock Pointer to the allocated lock. */
263 void IORWLockRead(IORWLock * lock);
267 @abstract Lock a read/write lock for write.
268 @discussion Lock the lock for write, allowing one writer exlusive access. If the lock is held for read or write, 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 lock recursively from one thread, for read or write, can result in deadlock.
269 @param lock Pointer to the allocated lock. */
274 void IORWLockWrite( IORWLock * lock);
278 @abstract Unlock a read/write lock.
279 @discussion Undo one call to IORWLockRead or IORWLockWrite. Results are undefined if the caller has not locked the lock. This function may block and so should not be called from interrupt level or while a spin lock is held.
280 @param lock Pointer to the allocated lock. */
285 void IORWLockUnlock( IORWLock * lock);
293 static __inline__ void IOReadLock( IORWLock * lock) { IORWLockRead(lock); }
294 static __inline__ void IOWriteLock( IORWLock * lock) { IORWLockWrite(lock); }
295 static __inline__ void IORWUnlock( IORWLock * lock) { IORWLockUnlock(lock); }
301 * Simple locks. Cannot block while holding a simple lock.
311 @abstract Allocates and initializes a spin lock.
312 @discussion Allocates and initializes a spin lock in general purpose memory. Spin locks provide non-blocking mutual exclusion for synchronization between thread context and interrupt context, or for multiprocessor synchronization, and are 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. IOSimpleLocks 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.
313 @result Pointer to the allocated lock, or zero on failure. */
318 @abstract Frees a spin lock.
319 @discussion Frees a lock allocated with IOSimpleLockAlloc.
320 @param lock Pointer to the lock. */
322 void IOSimpleLockFree( IOSimpleLock * lock );
325 @abstract Accessor to a Mach spin lock.
326 @discussion Accessor to the Mach spin lock.
327 @param lock Pointer to the allocated lock. */
329 lck_spin_t * IOSimpleLockGetMachLock( IOSimpleLock * lock);
332 @abstract Initialize a spin lock.
333 @discussion Initialize an embedded spin lock, to the unlocked state.
334 @param lock Pointer to the lock. */
336 void IOSimpleLockInit( IOSimpleLock * lock );
339 @abstract Lock a spin lock.
340 @discussion Lock the spin lock. If the lock is held, spin waiting for its unlock. Spin locks disable preemption, cannot be held across any blocking operation, and should be held for very short periods. When used to synchronize between interrupt context and thread context they should be locked with interrupts disabled - IOSimpleLockLockDisableInterrupt() will do both. Locking the lock recursively from one thread will result in deadlock.
341 @param lock Pointer to the lock. */
346 void IOSimpleLockLock( IOSimpleLock * lock );
351 @abstract Attempt to lock a spin lock.
352 @discussion Lock the spin lock if it is currently unlocked, and return true. If the lock is held, return false. Successful calls to IOSimpleLockTryLock should be balanced with calls to IOSimpleLockUnlock.
353 @param lock Pointer to the lock.
354 @result True if the lock was unlocked and is now locked by the caller, otherwise false. */
359 boolean_t IOSimpleLockTryLock( IOSimpleLock * lock );
363 @abstract Unlock a spin lock.
364 @discussion Unlock the lock, and restore preemption. Results are undefined if the caller has not locked the lock.
365 @param lock Pointer to the lock. */
370 void IOSimpleLockUnlock( IOSimpleLock * lock );
380 @abstract Lock a spin lock.
381 @discussion Lock the spin lock. If the lock is held, spin waiting for its unlock. Simple locks disable preemption, cannot be held across any blocking operation, and should be held for very short periods. When used to synchronize between interrupt context and thread context they should be locked with interrupts disabled - IOSimpleLockLockDisableInterrupt() will do both. Locking the lock recursively from one thread will result in deadlock.
382 @param lock Pointer to the lock. */
385 IOInterruptState IOSimpleLockLockDisableInterrupt( IOSimpleLock * lock )
388 IOSimpleLockLock( lock );
393 @abstract Unlock a spin lock, and restore interrupt state.
394 @discussion Unlock the lock, and restore preemption and interrupts to the state as they were when the lock was taken. Results are undefined if the caller has not locked the lock.
395 @param lock Pointer to the lock.
399 void IOSimpleLockUnlockEnableInterrupt( IOSimpleLock * lock,
402 IOSimpleLockUnlock( lock );