13#ifndef ZEPHYR_INCLUDE_SYS_SEM_H_
14#define ZEPHYR_INCLUDE_SYS_SEM_H_
35#ifdef CONFIG_USERSPACE
39 struct k_sem kernel_sem;
62#ifdef CONFIG_USERSPACE
63#define SYS_SEM_DEFINE(_name, _initial_count, _count_limit) \
64 struct sys_sem _name = { \
65 .futex = { _initial_count }, \
66 .limit = _count_limit \
68 BUILD_ASSERT(((_count_limit) != 0) && \
69 ((_initial_count) <= (_count_limit)))
74#define SYS_SEM_DEFINE(_name, _initial_count, _count_limit) \
75 STRUCT_SECTION_ITERABLE_ALTERNATE(k_sem, sys_sem, _name) = { \
76 .kernel_sem = Z_SEM_INITIALIZER(_name.kernel_sem, \
77 _initial_count, _count_limit) \
79 BUILD_ASSERT(((_count_limit) != 0) && \
80 ((_initial_count) <= (_count_limit)))
ZTEST_BMEM int timeout
Definition main.c:31
unsigned int sys_sem_count_get(struct sys_sem *sem)
Get sys_sem's value.
int sys_sem_give(struct sys_sem *sem)
Give a semaphore.
int sys_sem_init(struct sys_sem *sem, unsigned int initial_count, unsigned int limit)
Initialize a semaphore.
int sys_sem_take(struct sys_sem *sem, k_timeout_t timeout)
Take a sys_sem.
futex structure
Definition kernel.h:2145
Kernel timeout type.
Definition sys_clock.h:65
sys_sem structure
Definition sem.h:34
struct k_futex futex
Definition sem.h:36
int limit
Definition sem.h:37
static struct k_sem sem[3]
Definition timeout_order.c:14