BEEP-8 SDK 1.0.0
Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
1
27#pragma once
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <stdint.h>
34#include <time.h>
35typedef struct _sem_t {
36 volatile uint32_t sid;
37} sem_t;
38
51extern int sem_init(sem_t* sem, int pshared, unsigned int value);
52
64extern int sem_wait(sem_t* sem);
65
77extern int sem_timedwait(sem_t* sem, const struct timespec* __abstime);
78
90extern int sem_trywait(sem_t* sem);
91
102extern int sem_post(sem_t* sem);
103
114extern int sem_getvalue(sem_t* sem, int* sval);
115
116
117// The following API functions are not supported and cannot be used in the BEEP-8 system.
118#define SEM_FAILED ((sem_t *) 0)
119extern int sem_destroy(sem_t* sem);
120extern sem_t* sem_open (const char* name, int __oflag, ...);
121extern int sem_close (sem_t* sem);
122extern int sem_unlink(const char *name);
123
124#ifdef __cplusplus
125}
126#endif
int sem_post(sem_t *sem)
Post (signal) an unnamed semaphore.
Definition semaphore.c:49
int sem_trywait(sem_t *sem)
Try to wait on an unnamed semaphore without blocking.
Definition semaphore.c:27
int sem_init(sem_t *sem, int pshared, unsigned int value)
Initialize an unnamed semaphore.
Definition semaphore.c:6
int sem_getvalue(sem_t *sem, int *sval)
Get the current value of an unnamed semaphore.
Definition semaphore.c:54
int sem_wait(sem_t *sem)
Wait on an unnamed semaphore.
Definition semaphore.c:17
int sem_timedwait(sem_t *sem, const struct timespec *__abstime)
Wait on an unnamed semaphore with a timeout.
Definition semaphore.c:37
Definition semaphore.h:35