summaryrefslogtreecommitdiff
path: root/PACE/pace/semaphore.h
blob: 441a1f97cbdeda741b8164aff9932f1024279d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* $Id$

 * ============================================================================
 *
 * = LIBRARY
 *    pace
 *
 * = FILENAME
 *    semaphore.h
 *
 * = AUTHOR
 *    Luther Baker
 *
 * ============================================================================ */


#ifndef PACE_SEMAPHORE_H
#define PACE_SEMAPHORE_H


#include "pace/defines.h"
#include <semaphore.h>


# if defined (PACE_HAS_CPLUSPLUS)
extern "C" {
# endif /* PACE_HAS_CPLUSPLUS */

  PACE_INLINE int pace_sem_close (sem_t * sem);

  PACE_INLINE int pace_sem_destroy (sem_t * sem);

  PACE_INLINE int pace_sem_getvalue (sem_t * sem, int * sval);

  PACE_INLINE int pace_sem_init (sem_t * sem, int pshared, unsigned int value);

  # define pace_sem_open(X) sem_open X
  /* int fprintf (FILE *stream, const char *format, (*//* args *//*) ... );
   *
   * PLEASE PAY SPECIAL ATTENTION HERE!
   * This is a macro and requires an additional set of parenthesis
   * surrounding the arguments.
   */

  PACE_INLINE int pace_sem_post (sem_t * sem);

  PACE_INLINE int pace_sem_trywait (sem_t * sem);

  PACE_INLINE int pace_sem_unlink (const char * name);

  PACE_INLINE int pace_sem_wait (sem_t * sem);

# if defined (PACE_HAS_CPLUSPLUS)
}
# endif /* PACE_HAS_CPLUSPLUS */

# if defined (PACE_HAS_INLINE)
# include "semaphore.inl"
# endif /* PACE_HAS_INLINE */


#endif /* PACE_SEMAPHORE_H */