Merge branch 'dev' of ssh://gitlab.repo.digitech.hs-emden-leer.de:2222/link/projekte/ws19/vkvm-new/shared-memory into dev

This commit is contained in:
cigerxwinchaker 2019-11-06 13:23:14 +01:00
commit 55e262a889

View File

@ -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 )