bugfix
This commit is contained in:
parent
e787cbe355
commit
e565c06550
|
@ -1,5 +1,6 @@
|
||||||
#include "../src/SharedMemory.h"
|
#include "../src/SharedMemory.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
return test();
|
shared_memory_init();
|
||||||
|
//return main();
|
||||||
}
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstdio>
|
||||||
#include "SharedMemory.h"
|
#include "SharedMemory.h"
|
||||||
|
|
||||||
//Shared-Memory-Segment erstellen oder öffnen – shmget()
|
//Shared-Memory-Segment erstellen oder öffnen – shmget()
|
||||||
|
@ -7,12 +9,12 @@ void shared_memory_init(){
|
||||||
|
|
||||||
//Ein Shared-Memory-Segment abfragen, ändern oder löschen – shmctl()
|
//Ein Shared-Memory-Segment abfragen, ändern oder löschen – shmctl()
|
||||||
void delet_shared_memory(){
|
void delet_shared_memory(){
|
||||||
int shmctl(memory_id, IPC_RMID, 0);
|
memory_id = shmctl(memory_id, IPC_RMID, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Shared-Memory-Segment an einen Prozess anbinden (attach) – shmat()
|
//Shared-Memory-Segment an einen Prozess anbinden (attach) – shmat()
|
||||||
void attach_process(char *myProcess){
|
void attach_process(void *myProcess){
|
||||||
if(( myProcess = shmat( memmory_id, (char *)0, 0 )) < (char *)0 ){
|
if(( myProcess = shmat( memory_id, (char *)0, 0 )) < (char *)0 ){
|
||||||
perror("Fehler beim Ankoppeln des gemeinsamen Speicher Segments");
|
perror("Fehler beim Ankoppeln des gemeinsamen Speicher Segments");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
|
||||||
//ID-Speicherbereich
|
//ID-Speicherbereich
|
||||||
#define int memory_id
|
extern int memory_id;
|
||||||
//Größe des Speicherbereichs hier 8MB (8000)
|
//Größe des Speicherbereichs hier 8MB (8000)
|
||||||
#define SHMMAXSIZE 8000
|
#define SHMMAXSIZE 8000
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ void shared_memory_init();
|
||||||
void delet_shared_memory();
|
void delet_shared_memory();
|
||||||
|
|
||||||
//Shared-Memory-Segment an einen Prozess anbinden (attach) – shmat()
|
//Shared-Memory-Segment an einen Prozess anbinden (attach) – shmat()
|
||||||
void attach_process(char *myProcess);
|
void attach_process(void *myProcess);
|
||||||
|
|
||||||
//Ein Shared-Memory-Segment loslösen – shmdt()
|
//Ein Shared-Memory-Segment loslösen – shmdt()
|
||||||
void release_memory();
|
void release_memory();
|
||||||
|
|
|
@ -3,4 +3,5 @@
|
||||||
|
|
||||||
TEST_CASE("Demo test") {
|
TEST_CASE("Demo test") {
|
||||||
REQUIRE(test() == 42);
|
REQUIRE(test() == 42);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue