source: rtems/c/src/exec/posix/base/semaphore.h @ 5e9b32b

4.104.114.84.95
Last change on this file since 5e9b32b was 5e9b32b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/26/95 at 19:27:15

posix support initially added

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*  semaphore.h
2 *
3 */
4
5#ifndef __POSIX_SEMAPHORE_h
6#define __POSIX_SEMAPHORE_h
7
8#include <rtems/posix/features.h>
9
10#if defined(_POSIX_SEMAPHORES)
11
12#include <sys/time.h>
13
14/*
15 *  11.1 Semaphore Characteristics, P1003.1b-1993, p.219
16 */
17
18typedef int sem_t;
19
20/*
21 *  11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
22 */
23
24int sem_init(
25  sem_t         *sem,
26  int            pshared,
27  unsigned int   value
28);
29
30/*
31 *  11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
32 */
33
34int sem_destroy(
35  sem_t *sem
36);
37
38/*
39 *  11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
40 *
41 *  NOTE: Follows open() calling conventions.
42 */
43
44sem_t *sem_open(
45  const char *name,
46  int         oflag,
47  ...
48);
49
50/*
51 *  11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
52 */
53
54int sem_close(
55  sem_t *sem
56);
57
58/*
59 *  11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
60 */
61
62int sem_unlink(
63  const char *name
64);
65
66/*
67 *  11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
68 *
69 *  NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
70 */
71
72int sem_wait(
73  sem_t *sem
74);
75
76int sem_trywait(
77  sem_t *sem
78);
79
80#if defined(_POSIX_TIMEOUTS)
81int sem_timedwait(
82  sem_t                 *sem,
83  const struct timespec *timeout
84);
85#endif
86
87/*
88 *  11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
89 */
90
91int sem_post(
92  sem_t  *sem
93);
94
95/*
96 *  11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
97 */
98
99int sem_getvalue(
100  sem_t  *sem,
101  int    *sval
102);
103
104#endif   /* _POSIX_SEMAPHORES */
105
106#endif
107/* end of include file */
Note: See TracBrowser for help on using the repository browser.