This commit is contained in:
2020-06-29 20:01:55 +02:00
parent 75e9d63341
commit 285ef30439
10 changed files with 154 additions and 65 deletions

View File

@@ -20,6 +20,8 @@
typedef struct Memory {
int version;
sem_t sem;
int scanStatus;
int scanStop;
#ifdef VIRTUAL
int status;
int stop;
@@ -139,6 +141,7 @@ void sharedMemory_lock() { sem_wait(&(shm->sem)); }
void sharedMemory_unlock() { sem_post(&(shm->sem)); }
#ifdef VIRTUAL
void sharedMemory_setStatus(int s) {
sharedMemory_lock();
shm->status = s;
@@ -166,3 +169,32 @@ int sharedMemory_getStop() {
sharedMemory_unlock();
return s;
}
#endif
void sharedMemory_setScanStatus(int s) {
sharedMemory_lock();
shm->scanStatus = s;
sharedMemory_unlock();
}
int sharedMemory_getScanStatus() {
int s = 0;
sharedMemory_lock();
s = shm->scanStatus;
sharedMemory_unlock();
return s;
}
void sharedMemory_setScanStop(int s) {
sharedMemory_lock();
shm->scanStop = s;
sharedMemory_unlock();
}
int sharedMemory_getScanStop() {
int s = 0;
sharedMemory_lock();
s = shm->scanStop;
sharedMemory_unlock();
return s;
}