source: git/Singular/links/simpleipc.h @ 01776f

spielwiese
Last change on this file since 01776f was 2be6451, checked in by Hans Schoenemann <hannes@…>, 7 years ago
Reimer Behrends: semphore patch for Os X
  • Property mode set to 100644
File size: 781 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 sipc_sem_t *semaphore[SIPC_MAX_SEMAPHORES];
32extern 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.