Im Header die Funktionen und Variablen Definiert
In der cpp Datei die init Funktion definiert
This commit is contained in:
parent
4abc21c92a
commit
4d6678e0a4
|
@ -1,5 +1,7 @@
|
|||
#include "SharedMemory.h"
|
||||
|
||||
int test() {
|
||||
return 41;
|
||||
//Shared-Memory-Segment erstellen oder öffnen – shmget()
|
||||
void shared-memory-init(){
|
||||
memmory-id = shmget(IPC_PRIVATE, SHMMAXSIZE, IPC_CREAT | IPC_EXCL);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,27 @@
|
|||
#ifndef SHARED_MEMORY_DEMO_H
|
||||
#define SHARED_MEMORY_DEMO_H
|
||||
#ifndef SHARED_MEMORY_H
|
||||
#define SHARED_MEMORY_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
//ID-Speicherbereich
|
||||
#define int speicher-id
|
||||
//Größe des Speicherbereichs hier 8MB (64bit)
|
||||
#define SHMMAXSIZE 64
|
||||
|
||||
|
||||
int test();
|
||||
//Shared-Memory-Segment erstellen oder öffnen – shmget()
|
||||
void shared-memory-init();
|
||||
|
||||
//Ein Shared-Memory-Segment abfragen, ändern oder löschen
|
||||
void delet-shared-memory();
|
||||
int shmctl(int shm_id, int kommando, struct shmid_ds *buf);
|
||||
|
||||
#endif //SHARED_MEMORY_DEMO_H
|
||||
//Shared-Memory-Segment an einen Prozess anbinden (attach)
|
||||
void *shmat(int shm_id, const void *adresse, int flag);
|
||||
|
||||
// Ein Shared-Memory-Segment loslösen – shmdt()
|
||||
int shmdt(void *adresse);
|
||||
|
||||
#endif //SHARED_MEMORY_H
|
||||
|
|
Loading…
Reference in New Issue