The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @file semaphore.h
5 * @brief unnamed POSIX semaphores, for the threads of one process.
6 * sem_init with pshared set fails with ENOSYS.
7 */
8
9#include <time.h>
10
11typedef struct
12{
13 volatile int value;
14 volatile int waiters;
15} sem_t;
16
17#define SEM_VALUE_MAX 0x7FFFFFFF
18
19int sem_init(sem_t *sem, int pshared, unsigned value);
21int sem_wait(sem_t *sem);
23int sem_timedwait(sem_t *sem, const struct timespec *abstime);
24int sem_post(sem_t *sem);
25int sem_getvalue(sem_t *sem, int *value);
int sem_post(sem_t *sem)
int sem_getvalue(sem_t *sem, int *value)
int sem_trywait(sem_t *sem)
int sem_destroy(sem_t *sem)
int sem_init(sem_t *sem, int pshared, unsigned value)
int sem_timedwait(sem_t *sem, const struct timespec *abstime)
int sem_wait(sem_t *sem)
Definition semaphore.h:12
volatile int value
Definition semaphore.h:13
volatile int waiters
Definition semaphore.h:14
Definition time.h:26
clocks, sleeping and calendar time (UTC only: there are no time zones, so local time is UTC).