Semaphores.
More...
#include "FreeRTOS_POSIX/time.h"
#include "FreeRTOS_POSIX_types.h"
Go to the source code of this file.
|
typedef PosixSemType_t | sem_t |
| Semaphore type.
|
|
◆ sem_destroy()
int sem_destroy |
( |
sem_t * |
sem | ) |
|
◆ sem_getvalue()
int sem_getvalue |
( |
sem_t * |
sem, |
|
|
int * |
sval |
|
) |
| |
◆ sem_init()
int sem_init |
( |
sem_t * |
sem, |
|
|
int |
pshared, |
|
|
unsigned |
value |
|
) |
| |
Initialize an unnamed semaphore.
- See also
- http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_init.html
- Note
- pshared is ignored. Semaphores will always be considered "shared".
- Return values
-
0 | - upon successful completion |
-1 | - otherwise. System error variable errno is also set in this case. |
- Side Effects Possible errno values
EINVAL - The value argument exceeds {SEM_VALUE_MAX}.
ENOSPC - A resource required to initialize the semaphore has been exhausted.
◆ sem_post()
int sem_post |
( |
sem_t * |
sem | ) |
|
◆ sem_timedwait()
int sem_timedwait |
( |
sem_t * |
sem, |
|
|
const struct timespec * |
abstime |
|
) |
| |
Lock a semaphore with timeout.
- See also
- http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_timedwait.html
- Return values
-
0 | - upon successful completion |
-1 | - otherwise. System error variable errno is also set in this case. |
- Side Effects Possible errno values
EINVAL - parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million
ETIMEDOUT - The semaphore could not be locked before the specified timeout expired.
- Note
- Deadlock detection is not implemented.
◆ sem_trywait()
int sem_trywait |
( |
sem_t * |
sem | ) |
|
◆ sem_wait()
int sem_wait |
( |
sem_t * |
sem | ) |
|