r1009: Move the dependencies to newer package names
[cinelerra_cv/mob.git] / cinelerra / shmemory.C
blobdb6d27afc593426c86bb3e93b71d859a8a33de06
1 #include <string.h>
2 #include "bcipc.h"
3 #include "shmemory.h"
6 SharedMem::SharedMem(long size)
8         shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
9         if(shmid < 0)
10                 perror("SharedMem::SharedMem");
11         else
12         {
13                 data = (char*)shmat(shmid, 0, 0);
14                 shmctl(shmid, IPC_RMID, 0);
15         }
16         this->size = size;
17         client = 0;
20 SharedMem::SharedMem(int id, long size)
22         this->shmid = id;
24         data = (char*)shmat(shmid, 0, 0);
25         this->size = size;
26         client = 1;
29 SharedMem::~SharedMem()
31         shmdt(data);
32         data = 0;
33         size = 0;
34         shmid = 0;
37 int SharedMem::get_id()
39         return shmid;
42 long SharedMem::get_size()
44         return size;