simpleipc.h
Go to the documentation of this file.
1 #include <semaphore.h>
2 
3 #ifndef _SIMPLEIPC_H
4 #define _SIMPLEIPC_H
5 
6 #ifdef __cplusplus
7 extern "C"
8 {
9 #endif
10 #define SIPC_MAX_SEMAPHORES 256
11 
12 #define USE_SEM_INIT 0
13 
14 #ifdef __APPLE__
15 #define PORTABLE_SEMAPHORES 1
16 #endif
17 
18 #if PORTABLE_SEMAPHORES
19 
20 #include <sys/mman.h>
21 
22 typedef struct {
23  sem_t *guard, *sig;
24  int count;
25 } sipc_sem_t;
26 #else
27 typedef sem_t sipc_sem_t;
28 #endif
29 
30 
33 
34 int sipc_semaphore_init(int id, int count);
35 int sipc_semaphore_exists(int id);
36 int sipc_semaphore_acquire(int id);
37 int sipc_semaphore_try_acquire(int id);
38 int sipc_semaphore_get_value(int id);
39 int sipc_semaphore_release(int id);
40 
41 int simpleipc_cmd(char *cmd, int id, int v);
42 #ifdef __cplusplus
43 }
44 #endif
45 #endif
int status int void size_t count
Definition: si_signals.h:59
int sipc_semaphore_release(int id)
Definition: semaphore.c:135
int sipc_semaphore_acquire(int id)
Definition: semaphore.c:94
int sipc_semaphore_exists(int id)
Definition: semaphore.c:88
int sipc_semaphore_init(int id, int count)
Definition: semaphore.c:31
int sipc_semaphore_try_acquire(int id)
Definition: semaphore.c:112
int sipc_semaphore_get_value(int id)
Definition: semaphore.c:153
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
sem_t sipc_sem_t
Definition: simpleipc.h:27
int sem_acquired[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:25
sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:24
#define SIPC_MAX_SEMAPHORES
Definition: simpleipc.h:10
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:167