My Project
Loading...
Searching...
No Matches
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
7extern "C"
8{
9#endif
10#define SIPC_MAX_SEMAPHORES 512
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
22typedef struct {
23 sem_t *guard, *sig;
24 int count;
26#else
27typedef sem_t sipc_sem_t;
28#endif
29
30
33
34int sipc_semaphore_init(int id, int count);
35int sipc_semaphore_exists(int id);
36int sipc_semaphore_acquire(int id);
38int sipc_semaphore_get_value(int id);
39int sipc_semaphore_release(int id);
40
41int simpleipc_cmd(char *cmd, int id, int v);
42#ifdef __cplusplus
43}
44#endif
45#endif
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
#define EXTERN_VAR
Definition: globaldefs.h:6
int status int void size_t count
Definition: si_signals.h:59
#define SIPC_MAX_SEMAPHORES
Definition: simpleipc.h:10
int sipc_semaphore_get_value(int id)
Definition: semaphore.c:153
EXTERN_VAR sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
Definition: simpleipc.h:31
sem_t sipc_sem_t
Definition: simpleipc.h:27
int sipc_semaphore_acquire(int id)
Definition: semaphore.c:94
EXTERN_VAR int sem_acquired[SIPC_MAX_SEMAPHORES]
Definition: simpleipc.h:32
int sipc_semaphore_release(int id)
Definition: semaphore.c:135
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:167
int sipc_semaphore_exists(int id)
Definition: semaphore.c:88
int sipc_semaphore_try_acquire(int id)
Definition: semaphore.c:112
int sipc_semaphore_init(int id, int count)
Definition: semaphore.c:31