Zephyr API Documentation 4.5.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sem.h File Reference

public sys_sem APIs. More...

#include <zephyr/kernel.h>
#include <zephyr/sys/atomic.h>
#include <zephyr/types.h>
#include <zephyr/sys/iterable_sections.h>
#include <zephyr/sys/__assert.h>

Go to the source code of this file.

Data Structures

struct  sys_sem
 sys_sem structure More...

Macros

#define SYS_SEM_DEFINE(_name, _initial_count, _count_limit)
 Statically define and initialize a sys_sem.
#define SYS_SEM_LOCK_BREAK   continue
 Leaves a code block guarded with SYS_SEM_LOCK after releasing the lock.
#define SYS_SEM_LOCK(sem)
 Guards a code block with the given sys_sem, automatically acquiring the semaphore before executing the code block.

Functions

int sys_sem_init (struct sys_sem *sem, unsigned int initial_count, unsigned int limit)
 Initialize a semaphore.
int sys_sem_give (struct sys_sem *sem)
 Give a semaphore.
int sys_sem_take (struct sys_sem *sem, k_timeout_t timeout)
 Take a sys_sem.
unsigned int sys_sem_count_get (struct sys_sem *sem)
 Get sys_sem's value.

Detailed Description

public sys_sem APIs.