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:
commit
55e262a889
|
@ -8,18 +8,17 @@
|
||||||
int memoryAccessKey = 12345;
|
int memoryAccessKey = 12345;
|
||||||
int memID;
|
int memID;
|
||||||
|
|
||||||
//Shared-Memory-Segment erstellen oder öffnen – shmget()
|
void sharedMemoryInit() {
|
||||||
void sharedMemoryInit()
|
if ((memID = shmget(memoryAccessKey, Max_Memory_Size, IPC_CREAT | IPC_EXCL | 0666)) < 0) {
|
||||||
{
|
std::cerr << "Shared memory with Key: " << memoryAccessKey
|
||||||
if((memID = shmget(memoryAccessKey, Max_Memory_Size, IPC_CREAT | IPC_EXCL | 0666)) < 0)
|
<< " already exists. Delete by Hand before starting vKFM" << std::endl;
|
||||||
{
|
|
||||||
std::cerr << "Shared memory with Key: " << memoryAccessKey << " already exists. Delete by Hand before starting vKFM" << std::endl;
|
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Shared memory with Key: " << memoryAccessKey << " allocated" << std::endl;
|
std::cout << "Shared memory with Key: " << memoryAccessKey << " allocated" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void deleteSharedMemory(int s)
|
void deleteSharedMemory(int s)
|
||||||
{
|
{
|
||||||
if (shmctl(memID, IPC_RMID, NULL) < 0 )
|
if (shmctl(memID, IPC_RMID, NULL) < 0 )
|
||||||
|
|
Loading…
Reference in New Issue