Lines Matching full:mutex

39  * - only one task can hold the mutex at a time
40 * - only the owner can unlock the mutex
43 * - a mutex object must be initialized via the API
44 * - a mutex object must not be initialized via memset or copying
45 * - task may not exit with mutex held
52 * enabled. Furthermore, besides enforcing the above rules, the mutex
64 struct mutex { struct
84 extern void mutex_destroy(struct mutex *lock); argument
90 static inline void mutex_destroy(struct mutex *lock) {} in mutex_destroy()
95 * mutex_init - initialize the mutex
96 * @mutex: the mutex to be initialized
98 * Initialize the mutex to unlocked state.
100 * It is not allowed to initialize an already locked mutex.
102 #define mutex_init(mutex) \ argument
106 __mutex_init((mutex), #mutex, &__key); \
117 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
119 extern void __mutex_init(struct mutex *lock, const char *name,
123 * mutex_is_locked - is the mutex locked
124 * @lock: the mutex to be queried
126 * Returns true if the mutex is locked, false if unlocked.
128 extern bool mutex_is_locked(struct mutex *lock);
136 struct mutex { struct
150 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) argument
152 extern void __mutex_rt_init(struct mutex *lock, const char *name,
154 extern int mutex_trylock(struct mutex *lock);
156 static inline void mutex_destroy(struct mutex *lock) { } in mutex_destroy()
160 #define __mutex_init(mutex, name, key) \ argument
162 rt_mutex_base_init(&(mutex)->rtmutex); \
163 __mutex_rt_init((mutex), name, key); \
166 #define mutex_init(mutex) \ argument
170 __mutex_init((mutex), #mutex, &__key); \
175 * See kernel/locking/mutex.c for detailed documentation of these APIs.
176 * Also see Documentation/locking/mutex-design.rst.
179 extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
180 extern void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock);
182 extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock,
184 extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
186 extern void mutex_lock_io_nested(struct mutex *lock, unsigned int subclass);
200 extern void mutex_lock(struct mutex *lock);
201 extern int __must_check mutex_lock_interruptible(struct mutex *lock);
202 extern int __must_check mutex_lock_killable(struct mutex *lock);
203 extern void mutex_lock_io(struct mutex *lock);
216 * Returns 1 if the mutex has been acquired successfully, and 0 on contention.
218 extern int mutex_trylock(struct mutex *lock);
219 extern void mutex_unlock(struct mutex *lock);
221 extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
223 DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T))
224 DEFINE_FREE(mutex, struct mutex *, if (_T) mutex_unlock(_T))