Xenomai 3.3.2
Loading...
Searching...
No Matches
semaphore.h
1/*
2 * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
18#pragma GCC system_header
19#include_next <semaphore.h>
20
21#ifndef _COBALT_SEMAPHORE_H
22#define _COBALT_SEMAPHORE_H
23
24#include <boilerplate/atomic.h>
25#include <cobalt/uapi/sem.h>
26#include <cobalt/wrappers.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32COBALT_DECL(int, sem_init, (sem_t *sem, int pshared, unsigned int value));
33
34COBALT_DECL(int, sem_destroy, (sem_t *sem));
35
36COBALT_DECL(int, sem_post, (sem_t *sem));
37
38COBALT_DECL(int, sem_wait, (sem_t *sem));
39
40COBALT_DECL_TIME64(int, sem_timedwait, __sem_timedwait64,
41 (sem_t *sem, const struct timespec *abs_timeout));
42
43COBALT_DECL(int, sem_trywait, (sem_t *sem));
44
45COBALT_DECL(int, sem_getvalue, (sem_t *sem, int *value));
46
47COBALT_DECL(sem_t *, sem_open, (const char *name, int oflags, ...));
48
49COBALT_DECL(int, sem_close, (sem_t *sem));
50
51COBALT_DECL(int, sem_unlink, (const char *name));
52
53int sem_init_np(sem_t *sem,
54 int flags,
55 unsigned int value);
56
57int sem_broadcast_np(sem_t *sem);
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif /* !_COBALT_SEMAPHORE_H */
int sem_post(sem_t *sem))
Post a semaphore.
Definition semaphore.c:184
int sem_trywait(sem_t *sem))
Attempt to decrement a semaphore.
Definition semaphore.c:246
int sem_close(sem_t *sem))
Close a named semaphore.
Definition semaphore.c:553
int sem_init(sem_t *sem, int pshared, unsigned int value))
Initialize an unnamed semaphore.
Definition semaphore.c:86
int sem_destroy(sem_t *sem))
Destroy an unnamed semaphore.
Definition semaphore.c:138
int sem_unlink(const char *name))
Unlink a named semaphore.
Definition semaphore.c:600
int sem_wait(sem_t *sem))
Decrement a semaphore.
Definition semaphore.c:309