Select one of the symbols to view example projects that use it.
 
Outline
#include <time.h>
sem_t
#define SEM_VALUE_MAX
sem_destroy(sem_t *);
sem_init(sem_t *, int, unsigned int);
sem_post(sem_t *);
sem_timedwait(sem_t *restrict, const struct timespec *restrict);
sem_trywait(sem_t *);
sem_wait(sem_t *);
sem_getvalue(sem_t *restrict, int *restrict);
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/newlib/platform_include/semaphore.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #include <time.h> #ifdef __cplusplus extern "C" { #endif typedef unsigned int sem_t; /** * This is the maximum value to which any POSIX semaphore can count on ESP chips. *//* ... */ #define SEM_VALUE_MAX 0x7FFF /** * This is a POSIX function, please refer to the POSIX specification for a detailed description. * * Must NOT be called if threads are still blocked on semaphore! *//* ... */ int sem_destroy(sem_t *sem); /** * This is a POSIX function, please refer to the POSIX specification for a detailed description. * * Note that on ESP chips, pshared is ignored. Semaphores can always be shared between FreeRTOS tasks. *//* ... */ int sem_init(sem_t *sem, int pshared, unsigned value); /** * This is a POSIX function, please refer to the POSIX specification for a detailed description. * * Note that, unlike specified in POSIX, this implementation returns -1 and sets errno to * EAGAIN if the semaphore can not be unlocked (posted) due to its value being SEM_VALUE_MAX. *//* ... */ int sem_post(sem_t *sem); /** * This is a POSIX function, please refer to the POSIX specification for a detailed description. * * Note the following three deviations/issues originating from the underlying FreeRTOS implementation: * * The time value passed by abstime will be rounded up to the next FreeRTOS tick. * * The actual timeout will happen after the tick the time was rounded to * and before the following tick. * * It is possible, though unlikely, that the task is preempted directly after the timeout calculation, * delaying timeout of the following blocking operating system call by the duration of the preemption. *//* ... */ int sem_timedwait(sem_t *semaphore, const struct timespec *abstime); /** * This is a POSIX function, please refer to the POSIX specification for a detailed description. *//* ... */ int sem_trywait(sem_t *sem); /** * This is a POSIX function, please refer to the POSIX specification for a detailed description. *//* ... */ int sem_wait(sem_t *sem); /** * This is a POSIX function, please refer to the POSIX specification for a detailed description. *//* ... */ int sem_getvalue(sem_t *sem, int *sval); #ifdef __cplusplus }{...} #endif
Details