13#ifndef ZEPHYR_INCLUDE_SYS_SEM_H_
14#define ZEPHYR_INCLUDE_SYS_SEM_H_
34#ifdef CONFIG_USERSPACE
38 struct k_sem kernel_sem;
61#ifdef CONFIG_USERSPACE
62#define SYS_SEM_DEFINE(_name, _initial_count, _count_limit) \
63 struct sys_sem _name = { \
64 .futex = { _initial_count }, \
65 .limit = _count_limit \
67 BUILD_ASSERT(((_count_limit) != 0) && \
68 ((_initial_count) <= (_count_limit)))
73#define SYS_SEM_DEFINE(_name, _initial_count, _count_limit) \
74 STRUCT_SECTION_ITERABLE_ALTERNATE(k_sem, sys_sem, _name) = { \
75 .kernel_sem = Z_SEM_INITIALIZER(_name.kernel_sem, \
76 _initial_count, _count_limit) \
78 BUILD_ASSERT(((_count_limit) != 0) && \
79 ((_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:1949
Kernel timeout type.
Definition: sys_clock.h:65
struct k_futex futex
Definition: sem.h:35
int limit
Definition: sem.h:36
static struct k_sem sem[3]
Definition: timeout_order.c:14