Lines Matching +full:lock +full:- +full:- +full:- +full:-

1 /* SPDX-License-Identifier: GPL-2.0 */
38 * - only one task can hold the mutex at a time
39 * - only the owner can unlock the mutex
40 * - multiple unlocks are not permitted
41 * - recursive locking is not permitted
42 * - a mutex object must be initialized via the API
43 * - a mutex object must not be initialized via memset or copying
44 * - task may not exit with mutex held
45 * - memory areas where held locks reside must not be freed
46 * - held mutexes must not be reinitialized
47 * - mutexes may not be used in hardware or software interrupt
53 * that make lock debugging easier and faster:
55 * - uses symbolic names of mutexes, whenever they are printed in debug output
56 * - point-of-acquire tracking, symbolic lookup of function names
57 * - list of all locks held in the system, printout of them
58 * - owner tracking
59 * - detects self-recursing locks and prints out all relevant info
60 * - detects multi-task circular deadlocks and prints out all affected
67 struct optimistic_spin_queue osq; /* Spinner MCS lock */
83 extern void mutex_destroy(struct mutex *lock);
89 static inline void mutex_destroy(struct mutex *lock) {} in mutex_destroy() argument
94 * mutex_init - initialize the mutex
118 extern void __mutex_init(struct mutex *lock, const char *name,
122 * mutex_is_locked - is the mutex locked
123 * @lock: the mutex to be queried
127 extern bool mutex_is_locked(struct mutex *lock);
131 * Preempt-RT variant based on rtmutexes.
151 extern void __mutex_rt_init(struct mutex *lock, const char *name,
153 extern int mutex_trylock(struct mutex *lock);
155 static inline void mutex_destroy(struct mutex *lock) { } in mutex_destroy() argument
157 #define mutex_is_locked(l) rt_mutex_base_is_locked(&(l)->rtmutex)
161 rt_mutex_base_init(&(mutex)->rtmutex); \
175 * Also see Documentation/locking/mutex-design.rst.
178 extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
179 extern void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock);
181 extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock,
183 extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
185 extern void mutex_lock_io_nested(struct mutex *lock, unsigned int subclass);
187 #define mutex_lock(lock) mutex_lock_nested(lock, 0) argument
188 #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) argument
189 #define mutex_lock_killable(lock) mutex_lock_killable_nested(lock, 0) argument
190 #define mutex_lock_io(lock) mutex_lock_io_nested(lock, 0) argument
192 #define mutex_lock_nest_lock(lock, nest_lock) \ argument
194 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
195 _mutex_lock_nest_lock(lock, &(nest_lock)->dep_map); \
199 extern void mutex_lock(struct mutex *lock);
200 extern int __must_check mutex_lock_interruptible(struct mutex *lock);
201 extern int __must_check mutex_lock_killable(struct mutex *lock);
202 extern void mutex_lock_io(struct mutex *lock);
204 # define mutex_lock_nested(lock, subclass) mutex_lock(lock) argument
205 # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) argument
206 # define mutex_lock_killable_nested(lock, subclass) mutex_lock_killable(lock) argument
207 # define mutex_lock_nest_lock(lock, nest_lock) mutex_lock(lock) argument
208 # define mutex_lock_io_nested(lock, subclass) mutex_lock_io(lock) argument
217 extern int mutex_trylock(struct mutex *lock);
218 extern void mutex_unlock(struct mutex *lock);
220 extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);