Home
last modified time | relevance | path

Searched refs:lock (Results 1 – 25 of 334) sorted by relevance

12345678910>>...14

/Zephyr-Core-3.5.0/tests/posix/common/src/
Dspinlock.c14 pthread_spinlock_t lock; in ZTEST() local
18 zassert_equal(pthread_spin_init(&lock, 42), EINVAL, in ZTEST()
23 zassert_ok(pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE), "pthread_spin_init() failed"); in ZTEST()
24 zassert_ok(pthread_spin_destroy(&lock), "pthread_spin_destroy() failed"); in ZTEST()
29 pthread_spinlock_t lock[CONFIG_MAX_PTHREAD_SPINLOCK_COUNT]; in ZTEST() local
32 for (size_t i = 0; i < ARRAY_SIZE(lock); ++i) { in ZTEST()
33 zassert_ok(pthread_spin_init(&lock[i], PTHREAD_PROCESS_PRIVATE), in ZTEST()
37 zassert_equal(pthread_spin_init(&lock[CONFIG_MAX_PTHREAD_SPINLOCK_COUNT], in ZTEST()
43 for (size_t i = 0; i < ARRAY_SIZE(lock); ++i) { in ZTEST()
44 zassert_ok(pthread_spin_destroy(&lock[i]), in ZTEST()
[all …]
/Zephyr-Core-3.5.0/lib/libc/picolibc/
Dlibc-hooks.c130 void __retarget_lock_init_recursive(_LOCK_T *lock) in __retarget_lock_init_recursive() argument
132 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init_recursive()
136 *lock = malloc(sizeof(struct k_mutex)); in __retarget_lock_init_recursive()
138 *lock = k_object_alloc(K_OBJ_MUTEX); in __retarget_lock_init_recursive()
140 __ASSERT(*lock != NULL, "recursive lock allocation failed"); in __retarget_lock_init_recursive()
142 k_mutex_init((struct k_mutex *)*lock); in __retarget_lock_init_recursive()
146 void __retarget_lock_init(_LOCK_T *lock) in __retarget_lock_init() argument
148 __retarget_lock_init_recursive(lock); in __retarget_lock_init()
152 void __retarget_lock_close_recursive(_LOCK_T lock) in __retarget_lock_close_recursive() argument
154 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_close_recursive()
[all …]
/Zephyr-Core-3.5.0/subsys/modem/
Dmodem_pipe.c25 k_mutex_init(&pipe->lock); in modem_pipe_init()
33 k_mutex_lock(&pipe->lock, K_FOREVER); in modem_pipe_open()
35 k_mutex_unlock(&pipe->lock); in modem_pipe_open()
41 k_mutex_unlock(&pipe->lock); in modem_pipe_open()
46 k_mutex_unlock(&pipe->lock); in modem_pipe_open()
50 k_condvar_wait(&pipe->condvar, &pipe->lock, K_MSEC(10000)); in modem_pipe_open()
52 k_mutex_unlock(&pipe->lock); in modem_pipe_open()
60 k_mutex_lock(&pipe->lock, K_FOREVER); in modem_pipe_open_async()
66 k_mutex_unlock(&pipe->lock); in modem_pipe_open_async()
71 k_mutex_unlock(&pipe->lock); in modem_pipe_open_async()
[all …]
/Zephyr-Core-3.5.0/lib/posix/
Dspinlock.c15 struct k_spinlock lock; member
41 static inline size_t to_posix_spinlock_idx(pthread_spinlock_t lock) in to_posix_spinlock_idx() argument
43 return mark_pthread_obj_uninitialized(lock); in to_posix_spinlock_idx()
46 static struct k_spinlock *get_posix_spinlock(pthread_spinlock_t *lock) in get_posix_spinlock() argument
51 if (lock == NULL) { in get_posix_spinlock()
56 bit = to_posix_spinlock_idx(*lock); in get_posix_spinlock()
57 if (!is_pthread_obj_initialized(*lock)) { in get_posix_spinlock()
74 int pthread_spin_init(pthread_spinlock_t *lock, int pshared) in pthread_spin_init() argument
79 if (lock == NULL || in pthread_spin_init()
90 *lock = mark_pthread_obj_initialized(bit); in pthread_spin_init()
[all …]
Deventfd.c22 struct k_spinlock lock; member
176 struct k_mutex *lock = NULL; in eventfd_close_op() local
186 err = (int)z_get_obj_lock_and_cond(obj, &eventfd_fd_vtable, &lock, &cond); in eventfd_close_op()
188 __ASSERT_NO_MSG(lock != NULL); in eventfd_close_op()
191 err = k_mutex_lock(lock, K_FOREVER); in eventfd_close_op()
194 key = k_spin_lock(&efd->lock); in eventfd_close_op()
211 k_spin_unlock(&efd->lock, key); in eventfd_close_op()
215 err = k_mutex_unlock(lock); in eventfd_close_op()
228 key = k_spin_lock(&efd->lock); in eventfd_ioctl_op()
284 k_spin_unlock(&efd->lock, key); in eventfd_ioctl_op()
[all …]
/Zephyr-Core-3.5.0/kernel/
Dobj_core.c10 static struct k_spinlock lock; variable
36 k_spinlock_key_t key = k_spin_lock(&lock); in k_obj_core_link()
40 k_spin_unlock(&lock, key); in k_obj_core_link()
52 k_spinlock_key_t key = k_spin_lock(&lock); in k_obj_core_unlink()
56 k_spin_unlock(&lock, key); in k_obj_core_unlink()
65 k_spinlock_key_t key = k_spin_lock(&lock); in k_obj_type_find()
75 k_spin_unlock(&lock, key); in k_obj_type_find()
89 key = k_spin_lock(&lock); in k_obj_type_walk_locked()
99 k_spin_unlock(&lock, key); in k_obj_type_walk_locked()
128 k_spinlock_key_t key = k_spin_lock(&lock); in k_obj_core_stats_register()
[all …]
Datomic_c.c32 static struct k_spinlock lock; variable
95 key = k_spin_lock(&lock); in z_impl_atomic_cas()
102 k_spin_unlock(&lock, key); in z_impl_atomic_cas()
124 key = k_spin_lock(&lock); in z_impl_atomic_ptr_cas()
131 k_spin_unlock(&lock, key); in z_impl_atomic_ptr_cas()
166 key = k_spin_lock(&lock); in z_impl_atomic_add()
171 k_spin_unlock(&lock, key); in z_impl_atomic_add()
196 key = k_spin_lock(&lock); in z_impl_atomic_sub()
201 k_spin_unlock(&lock, key); in z_impl_atomic_sub()
247 key = k_spin_lock(&lock); in z_impl_atomic_set()
[all …]
Dmutex.c47 static struct k_spinlock lock; variable
111 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mutex, lock, mutex, timeout); in z_impl_k_mutex_lock()
113 key = k_spin_lock(&lock); in z_impl_k_mutex_lock()
128 k_spin_unlock(&lock, key); in z_impl_k_mutex_lock()
130 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mutex, lock, mutex, timeout, 0); in z_impl_k_mutex_lock()
136 k_spin_unlock(&lock, key); in z_impl_k_mutex_lock()
138 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mutex, lock, mutex, timeout, -EBUSY); in z_impl_k_mutex_lock()
143 SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_mutex, lock, mutex, timeout); in z_impl_k_mutex_lock()
154 int got_mutex = z_pend_curr(&lock, key, &mutex->wait_q, timeout); in z_impl_k_mutex_lock()
162 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mutex, lock, mutex, timeout, 0); in z_impl_k_mutex_lock()
[all …]
Dtimer.c16 static struct k_spinlock lock; variable
31 k_spinlock_key_t key = k_spin_lock(&lock); in z_timer_expiration_handler()
47 k_spin_unlock(&lock, key); in z_timer_expiration_handler()
86 k_spin_unlock(&lock, key); in z_timer_expiration_handler()
88 key = k_spin_lock(&lock); in z_timer_expiration_handler()
92 k_spin_unlock(&lock, key); in z_timer_expiration_handler()
99 k_spin_unlock(&lock, key); in z_timer_expiration_handler()
107 k_spin_unlock(&lock, key); in z_timer_expiration_handler()
219 k_spinlock_key_t key = k_spin_lock(&lock); in z_impl_k_timer_status_get()
223 k_spin_unlock(&lock, key); in z_impl_k_timer_status_get()
[all …]
Dcondvar.c19 static struct k_spinlock lock; variable
46 k_spinlock_key_t key = k_spin_lock(&lock); in z_impl_k_condvar_signal()
57 z_reschedule(&lock, key); in z_impl_k_condvar_signal()
59 k_spin_unlock(&lock, key); in z_impl_k_condvar_signal()
82 key = k_spin_lock(&lock); in z_impl_k_condvar_broadcast()
96 z_reschedule(&lock, key); in z_impl_k_condvar_broadcast()
117 key = k_spin_lock(&lock); in z_impl_k_condvar_wait()
120 ret = z_pend_curr(&lock, key, &condvar->wait_q, timeout); in z_impl_k_condvar_wait()
/Zephyr-Core-3.5.0/lib/libc/newlib/
Dlibc-hooks.c359 void __retarget_lock_init(_LOCK_T *lock) in __retarget_lock_init() argument
361 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init()
365 *lock = malloc(sizeof(struct k_sem)); in __retarget_lock_init()
367 *lock = k_object_alloc(K_OBJ_SEM); in __retarget_lock_init()
369 __ASSERT(*lock != NULL, "non-recursive lock allocation failed"); in __retarget_lock_init()
371 k_sem_init((struct k_sem *)*lock, 1, 1); in __retarget_lock_init()
375 void __retarget_lock_init_recursive(_LOCK_T *lock) in __retarget_lock_init_recursive() argument
377 __ASSERT_NO_MSG(lock != NULL); in __retarget_lock_init_recursive()
381 *lock = malloc(sizeof(struct k_mutex)); in __retarget_lock_init_recursive()
383 *lock = k_object_alloc(K_OBJ_MUTEX); in __retarget_lock_init_recursive()
[all …]
/Zephyr-Core-3.5.0/tests/drivers/rtc/rtc_api/src/
Dtest_update_callback.c16 static struct k_spinlock lock; variable
20 k_spinlock_key_t key = k_spin_lock(&lock); in test_rtc_update_callback_handler()
25 k_spin_unlock(&lock, key); in test_rtc_update_callback_handler()
39 key = k_spin_lock(&lock); in ZTEST()
44 k_spin_unlock(&lock, key); in ZTEST()
48 key = k_spin_lock(&lock); in ZTEST()
52 k_spin_unlock(&lock, key); in ZTEST()
62 key = k_spin_lock(&lock); in ZTEST()
67 k_spin_unlock(&lock, key); in ZTEST()
/Zephyr-Core-3.5.0/tests/lib/newlib/thread_safety/src/
Dlocks.c62 _LOCK_T lock = NULL; in ZTEST() local
65 __retarget_lock_init(&lock); in ZTEST()
66 zassert_not_null(lock, "non-recursive lock init failed"); in ZTEST()
69 __retarget_lock_acquire(lock); in ZTEST()
70 zassert_equal(__retarget_lock_try_acquire(lock), 0, in ZTEST()
74 __retarget_lock_release(lock); in ZTEST()
75 zassert_not_equal(__retarget_lock_try_acquire(lock), 0, in ZTEST()
79 __retarget_lock_close(lock); in ZTEST()
84 _LOCK_T lock = p1; in retargetable_lock_mutex_thread_acq() local
91 ret = __retarget_lock_try_acquire_recursive(lock); in retargetable_lock_mutex_thread_acq()
[all …]
/Zephyr-Core-3.5.0/lib/os/
Dfdtable.c30 struct k_mutex lock; member
47 .lock = Z_MUTEX_INITIALIZER(fdtable[0].lock),
54 .lock = Z_MUTEX_INITIALIZER(fdtable[1].lock),
61 .lock = Z_MUTEX_INITIALIZER(fdtable[2].lock),
145 ref_lock = (struct k_mutex)Z_MUTEX_INITIALIZER(fdtable[fd].lock); in fdtable_fd_is_initialized()
146 if (memcmp(&ref_lock, &fdtable[fd].lock, sizeof(ref_lock)) != 0) { in fdtable_fd_is_initialized()
191 bool z_get_obj_lock_and_cond(void *obj, const struct fd_op_vtable *vtable, struct k_mutex **lock, in z_get_obj_lock_and_cond() argument
204 if (lock) { in z_get_obj_lock_and_cond()
205 *lock = &entry->lock; in z_get_obj_lock_and_cond()
216 struct k_mutex **lock) in z_get_fd_obj_and_vtable() argument
[all …]
/Zephyr-Core-3.5.0/drivers/timer/
Dapic_timer.c78 static struct k_spinlock lock; variable
114 k_spinlock_key_t key = k_spin_lock(&lock); in sys_clock_set_timeout()
122 k_spin_unlock(&lock, key); in sys_clock_set_timeout()
130 k_spinlock_key_t key = k_spin_lock(&lock); in sys_clock_elapsed()
134 k_spin_unlock(&lock, key); in sys_clock_elapsed()
147 k_spinlock_key_t key = k_spin_lock(&lock); in isr()
156 k_spin_unlock(&lock, key); in isr()
168 k_spin_unlock(&lock, key); in isr()
178 k_spinlock_key_t key = k_spin_lock(&lock); in isr()
181 k_spin_unlock(&lock, key); in isr()
[all …]
/Zephyr-Core-3.5.0/drivers/counter/
Dcounter_ambiq_timer.c32 static struct k_spinlock lock; variable
38 k_spinlock_key_t key = k_spin_lock(&lock); in counter_ambiq_init()
48 k_spin_unlock(&lock, key); in counter_ambiq_init()
59 k_spinlock_key_t key = k_spin_lock(&lock); in counter_ambiq_start()
63 k_spin_unlock(&lock, key); in counter_ambiq_start()
70 k_spinlock_key_t key = k_spin_lock(&lock); in counter_ambiq_stop()
74 k_spin_unlock(&lock, key); in counter_ambiq_stop()
81 k_spinlock_key_t key = k_spin_lock(&lock); in counter_ambiq_get_value()
85 k_spin_unlock(&lock, key); in counter_ambiq_get_value()
99 k_spinlock_key_t key = k_spin_lock(&lock); in counter_ambiq_set_alarm()
[all …]
/Zephyr-Core-3.5.0/drivers/serial/
Duart_altera_jtag.c48 struct k_spinlock lock; member
92 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_jtag_poll_in()
102 k_spin_unlock(&data->lock, key); in uart_altera_jtag_poll_in()
130 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_jtag_poll_out()
138 k_spin_unlock(&data->lock, key); in uart_altera_jtag_poll_out()
213 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_jtag_fifo_fill()
225 k_spin_unlock(&data->lock, key); in uart_altera_jtag_fifo_fill()
257 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_jtag_fifo_read()
271 k_spin_unlock(&data->lock, key); in uart_altera_jtag_fifo_read()
287 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_jtag_irq_tx_enable()
[all …]
Duart_altera.c92 struct k_spinlock lock; member
157 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_poll_in()
167 k_spin_unlock(&data->lock, key); in uart_altera_poll_in()
187 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_poll_out()
196 k_spin_unlock(&data->lock, key); in uart_altera_poll_out()
255 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_err_check()
282 k_spin_unlock(&data->lock, key); in uart_altera_err_check()
412 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_fifo_fill()
428 k_spin_unlock(&data->lock, key); in uart_altera_fifo_fill()
462 k_spinlock_key_t key = k_spin_lock(&data->lock); in uart_altera_fifo_read()
[all …]
/Zephyr-Core-3.5.0/modules/thrift/src/thrift/concurrency/
DMutex.cpp22 struct k_spinlock lock; member in apache::thrift::concurrency::Mutex::impl
30 void Mutex::lock() const in lock() function in apache::thrift::concurrency::Mutex
39 return k_spin_trylock(&impl_->lock, &impl_->key) == 0; in trylock()
58 k_spin_unlock(&impl_->lock, impl_->key); in unlock()
63 return &impl_->lock; in getUnderlyingImpl()
/Zephyr-Core-3.5.0/scripts/coccinelle/
Dmini_lock.cocci2 /// where the unlock is missing from an if branch, and there is a lock
5 /// supposed to exit with the lock held, or where there is some preceding
6 /// function call that releases the lock.
43 identifier lock,unlock;
51 lock(E1@p,...)
67 identifier lock,unlock;
71 *lock(E1@p,...);
86 lock << err.lock;
91 cocci.print_main(lock,p)
96 lock << err.lock;
[all …]
/Zephyr-Core-3.5.0/kernel/include/
Dkswap.h78 struct k_spinlock *lock, in do_swap() argument
81 ARG_UNUSED(lock); in do_swap()
115 if (is_spinlock && lock != NULL && lock != &sched_spinlock) { in do_swap()
116 k_spin_release(lock); in do_swap()
118 if (!is_spinlock || lock != &sched_spinlock) { in do_swap()
186 static inline int z_swap(struct k_spinlock *lock, k_spinlock_key_t key) in z_swap() argument
188 return do_swap(key.key, lock, true); in z_swap()
217 static ALWAYS_INLINE int z_swap(struct k_spinlock *lock, k_spinlock_key_t key) in z_swap() argument
219 k_spin_release(lock); in z_swap()
/Zephyr-Core-3.5.0/drivers/w1/
Dw1_ds2482-800.c23 struct k_mutex lock; member
26 int ds2482_change_bus_lock_impl(const struct device *dev, bool lock) in ds2482_change_bus_lock_impl() argument
30 return lock ? k_mutex_lock(&data->lock, K_FOREVER) : k_mutex_unlock(&data->lock); in ds2482_change_bus_lock_impl()
40 k_mutex_init(&data->lock); in ds2482_init()
/Zephyr-Core-3.5.0/tests/kernel/spinlock/src/
Dspinlock_error_case.c13 static struct k_spinlock lock; variable
48 k_spin_unlock(&lock, key); in action_after_assert_fail()
101 key = k_spin_lock(&lock); in ZTEST()
104 re = k_spin_lock(&lock); in ZTEST()
120 key = k_spin_lock(&lock); in ZTEST()
139 key = k_spin_lock(&lock); in ZTEST()
/Zephyr-Core-3.5.0/drivers/eeprom/
Deeprom_stm32.c17 K_MUTEX_DEFINE(lock);
40 k_mutex_lock(&lock, K_FOREVER); in eeprom_stm32_read()
50 k_mutex_unlock(&lock); in eeprom_stm32_read()
71 k_mutex_lock(&lock, K_FOREVER); in eeprom_stm32_write()
82 k_mutex_unlock(&lock); in eeprom_stm32_write()
94 k_mutex_unlock(&lock); in eeprom_stm32_write()
98 k_mutex_unlock(&lock); in eeprom_stm32_write()
/Zephyr-Core-3.5.0/subsys/net/pkt_filter/
Dbase.c20 .lock = { },
25 .lock = { },
31 .lock = { },
38 .lock = { },
45 .lock = { },
124 k_spinlock_key_t key = k_spin_lock(&rules->lock); in lock_evaluate()
127 k_spin_unlock(&rules->lock, key); in lock_evaluate()
176 k_spinlock_key_t key = k_spin_lock(&rules->lock); in npf_insert_rule()
181 k_spin_unlock(&rules->lock, key); in npf_insert_rule()
189 k_spinlock_key_t key = k_spin_lock(&rules->lock); in npf_append_rule()
[all …]

12345678910>>...14