#include "kernel/mod2.h"
#include <semaphore.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "simpleipc.h"
#include "Singular/cntrlc.h"
#include "reporter/si_signals.h"
Go to the source code of this file.
◆ simpleipc_cmd()
Definition at line 167 of file semaphore.c.
168{
169 if (
strcmp(cmd,
"init")==0)
171 else if (
strcmp(cmd,
"exists")==0)
173 else if (
strcmp(cmd,
"acquire")==0)
175 else if (
strcmp(cmd,
"try_acquire")==0)
177 else if (
strcmp(cmd,
"release")==0)
179 else if (
strcmp(cmd,
"get_value")==0)
182 return -2;
183}
const Variable & v
< [in] a sqrfree bivariate poly
int sipc_semaphore_get_value(int id)
int sipc_semaphore_acquire(int id)
int sipc_semaphore_release(int id)
int sipc_semaphore_exists(int id)
int sipc_semaphore_try_acquire(int id)
int sipc_semaphore_init(int id, int count)
◆ sipc_semaphore_acquire()
int sipc_semaphore_acquire |
( |
int |
id | ) |
|
Definition at line 94 of file semaphore.c.
95{
98#if PORTABLE_SEMAPHORES
103#else
105#endif
109 return 1;
110}
VAR volatile BOOLEAN do_shutdown
VAR volatile int defer_shutdown
VAR sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
VAR int sem_acquired[SIPC_MAX_SEMAPHORES]
#define SIPC_MAX_SEMAPHORES
◆ sipc_semaphore_exists()
int sipc_semaphore_exists |
( |
int |
id | ) |
|
◆ sipc_semaphore_get_value()
int sipc_semaphore_get_value |
( |
int |
id | ) |
|
Definition at line 153 of file semaphore.c.
154{
155 int val;
157#if PORTABLE_SEMAPHORES
161#else
163#endif
164 return val;
165}
◆ sipc_semaphore_init()
int sipc_semaphore_init |
( |
int |
id, |
|
|
int |
count |
|
) |
| |
Definition at line 31 of file semaphore.c.
32{
36 return -1;
37
39 return 0;
40
41
42#if USE_SEM_INIT
43
44
47 return -1;
49 {
51 return -1;
52 }
53#else
54#if PORTABLE_SEMAPHORES
55#ifndef MAP_ANONYMOUS
56#define MAP_ANONYMOUS MAP_ANON
57#endif
61 return -1;
71#else
75#endif
76#endif
77#if !PORTABLE_SEMAPHORES
79 return -1;
80#endif
82#if !USE_SEM_INIT
84#endif
85 return 1;
86}
int status int void size_t count
int status int void * buf
◆ sipc_semaphore_release()
int sipc_semaphore_release |
( |
int |
id | ) |
|
Definition at line 135 of file semaphore.c.
136{
139#if PORTABLE_SEMAPHORES
144#else
146#endif
150 return 1;
151}
◆ sipc_semaphore_try_acquire()
int sipc_semaphore_try_acquire |
( |
int |
id | ) |
|
Definition at line 112 of file semaphore.c.
113{
116#if PORTABLE_SEMAPHORES
118#else
120#endif
122 {
123#if PORTABLE_SEMAPHORES
127#endif
129 }
133}
◆ sem_acquired
◆ semaphore