diff --git a/src/SharedMemory.cpp b/src/SharedMemory.cpp index 5c47251..0e36071 100644 --- a/src/SharedMemory.cpp +++ b/src/SharedMemory.cpp @@ -8,18 +8,17 @@ int memoryAccessKey = 12345; int memID; -//Shared-Memory-Segment erstellen oder öffnen – shmget() -void sharedMemoryInit() -{ - if((memID = shmget(memoryAccessKey, Max_Memory_Size, IPC_CREAT | IPC_EXCL | 0666)) < 0) - { - std::cerr << "Shared memory with Key: " << memoryAccessKey << " already exists. Delete by Hand before starting vKFM" << std::endl; +void sharedMemoryInit() { + if ((memID = shmget(memoryAccessKey, Max_Memory_Size, IPC_CREAT | IPC_EXCL | 0666)) < 0) { + std::cerr << "Shared memory with Key: " << memoryAccessKey + << " already exists. Delete by Hand before starting vKFM" << std::endl; exit(0); } else { std::cout << "Shared memory with Key: " << memoryAccessKey << " allocated" << std::endl; } } + void deleteSharedMemory(int s) { if (shmctl(memID, IPC_RMID, NULL) < 0 )