Lines Matching full:mutex

37  * @defgroup user_mutex_apis User mode mutex APIs
45 * The mutex can be accessed outside the module where it is defined using:
51 * @param name Name of the mutex.
57 * @brief Initialize a mutex.
59 * This routine initializes a mutex object, prior to its first use.
61 * Upon completion, the mutex is available and does not have an owner.
64 * and the mutex was not created with SYS_MUTEX_DEFINE().
66 * @param mutex Address of the mutex.
68 static inline void sys_mutex_init(struct sys_mutex *mutex) in sys_mutex_init() argument
70 ARG_UNUSED(mutex); in sys_mutex_init()
77 __syscall int z_sys_mutex_kernel_lock(struct sys_mutex *mutex,
80 __syscall int z_sys_mutex_kernel_unlock(struct sys_mutex *mutex);
83 * @brief Lock a mutex.
85 * This routine locks @a mutex. If the mutex is locked by another thread,
86 * the calling thread waits until the mutex becomes available or until
89 * A thread is permitted to lock a mutex it has already locked. The operation
92 * @param mutex Address of the mutex, which may reside in user memory
93 * @param timeout Waiting period to lock the mutex,
96 * @retval 0 Mutex locked.
99 * @retval -EACCES Caller has no access to provided mutex address
100 * @retval -EINVAL Provided mutex not recognized by the kernel
102 static inline int sys_mutex_lock(struct sys_mutex *mutex, k_timeout_t timeout) in sys_mutex_lock() argument
105 return z_sys_mutex_kernel_lock(mutex, timeout); in sys_mutex_lock()
109 * @brief Unlock a mutex.
111 * This routine unlocks @a mutex. The mutex must already be locked by the
114 * The mutex cannot be claimed by another thread until it has been unlocked by
118 * @param mutex Address of the mutex, which may reside in user memory
119 * @retval 0 Mutex unlocked
120 * @retval -EACCES Caller has no access to provided mutex address
121 * @retval -EINVAL Provided mutex not recognized by the kernel or mutex wasn't
123 * @retval -EPERM Caller does not own the mutex
125 static inline int sys_mutex_unlock(struct sys_mutex *mutex) in sys_mutex_unlock() argument
128 return z_sys_mutex_kernel_unlock(mutex); in sys_mutex_unlock()
131 #include <zephyr/syscalls/mutex.h>
146 static inline void sys_mutex_init(struct sys_mutex *mutex)
148 k_mutex_init(&mutex->kernel_mutex);
151 static inline int sys_mutex_lock(struct sys_mutex *mutex, k_timeout_t timeout)
153 return k_mutex_lock(&mutex->kernel_mutex, timeout);
156 static inline int sys_mutex_unlock(struct sys_mutex *mutex)
158 return k_mutex_unlock(&mutex->kernel_mutex);