Lines Matching full:mutex

22  * @brief Create and Initialize a Mutex object.
26 struct cv2_mutex *mutex; in osMutexNew() local
42 if (k_mem_slab_alloc(&cv2_mutex_slab, (void **)&mutex, K_MSEC(100)) == 0) { in osMutexNew()
43 memset(mutex, 0, sizeof(struct cv2_mutex)); in osMutexNew()
48 k_mutex_init(&mutex->z_mutex); in osMutexNew()
49 mutex->state = attr->attr_bits; in osMutexNew()
52 strncpy(mutex->name, init_mutex_attrs.name, in osMutexNew()
53 sizeof(mutex->name) - 1); in osMutexNew()
55 strncpy(mutex->name, attr->name, sizeof(mutex->name) - 1); in osMutexNew()
58 return (osMutexId_t)mutex; in osMutexNew()
62 * @brief Wait until a Mutex becomes available.
66 struct cv2_mutex *mutex = (struct cv2_mutex *) mutex_id; in osMutexAcquire() local
78 status = k_mutex_lock(&mutex->z_mutex, K_FOREVER); in osMutexAcquire()
80 status = k_mutex_lock(&mutex->z_mutex, K_NO_WAIT); in osMutexAcquire()
82 status = k_mutex_lock(&mutex->z_mutex, in osMutexAcquire()
96 * @brief Release a Mutex that was obtained by osMutexWait.
100 struct cv2_mutex *mutex = (struct cv2_mutex *) mutex_id; in osMutexRelease() local
110 if (k_mutex_unlock(&mutex->z_mutex) != 0) { in osMutexRelease()
118 * @brief Delete a Mutex that was created by osMutexCreate.
122 struct cv2_mutex *mutex = (struct cv2_mutex *)mutex_id; in osMutexDelete() local
132 /* The status code "osErrorResource" (mutex specified by parameter in osMutexDelete()
133 * mutex_id is in an invalid mutex state) is not supported in Zephyr. in osMutexDelete()
136 k_mem_slab_free(&cv2_mutex_slab, (void *)mutex); in osMutexDelete()
144 struct cv2_mutex *mutex = (struct cv2_mutex *)mutex_id; in osMutexGetOwner() local
146 if (k_is_in_isr() || (mutex == NULL)) { in osMutexGetOwner()
150 /* Mutex was not obtained before */ in osMutexGetOwner()
151 if (mutex->z_mutex.lock_count == 0U) { in osMutexGetOwner()
155 return get_cmsis_thread_id(mutex->z_mutex.owner); in osMutexGetOwner()
160 struct cv2_mutex *mutex = (struct cv2_mutex *)mutex_id; in osMutexGetName() local
162 if (k_is_in_isr() || (mutex == NULL)) { in osMutexGetName()
166 return mutex->name; in osMutexGetName()