source: git/Singular/links/simpleipc.h @ a3f0fea

spielwiese
Last change on this file since a3f0fea was a3f0fea, checked in by Reimer Behrends <behrends@…>, 5 years ago
Modify variable declarions for pSingular.
  • Property mode set to 100644
File size: 789 bytes
Line 
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 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
22typedef struct {
23  sem_t *guard, *sig;
24  int count;
25} sipc_sem_t;
26#else
27typedef sem_t sipc_sem_t;
28#endif
29
30
31EXTERN_VAR sipc_sem_t *semaphore[SIPC_MAX_SEMAPHORES];
32EXTERN_VAR int sem_acquired[SIPC_MAX_SEMAPHORES];
33
34int sipc_semaphore_init(int id, int count);
35int sipc_semaphore_exists(int id);
36int sipc_semaphore_acquire(int id);
37int sipc_semaphore_try_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
Note: See TracBrowser for help on using the repository browser.