Belle II Software  release-08-01-10
SharedMem Class Reference
Inheritance diagram for SharedMem:

Public Member Functions

 SharedMem (const char *name, int size)
 
 SharedMem (int shm_id, int sem_id, int size)
 
 ~SharedMem (void)
 
void * ptr (void)
 
int shmid (void)
 
bool IsCreated (void)
 
void lock (void)
 
void unlock (void)
 
bool isLocked (void)
 

Static Public Member Functions

static std::string getTmpFileName (std::string user, std::string name)
 
static bool getIdFromTmpFileName (std::string filename, int &shmid, int &semid)
 

Private Attributes

bool m_new {false}
 True if we created the ring buffer ourselves (and need to clean it).
 
key_t m_shmkey
 SHM key, see shmget(2).
 
key_t m_semkey
 Semaphore key.
 
int m_shmid {-1}
 shared memory id
 
int m_semid {-1}
 semaphore id
 
void * m_shmadr {nullptr}
 

Detailed Description

Definition at line 19 of file SharedMem.h.

Constructor & Destructor Documentation

◆ ~SharedMem()

~SharedMem ( void  )

this killed the shared mems if the b2hlt... utils are run, thus commented!

Definition at line 145 of file SharedMem.cc.

146 {
148 
149  //shmdt((const void*) m_shmadr);
150  //shmctl(m_shmid, IPC_RMID, NULL);
151  //printf("SharedMem: destructor called for ID %d\n", m_shmid);
152  // TODO: problem, neither semaphore nor tmp file are deleted if they exist
153  // TODO: there is no guarantee that the destructor is called (e.g. on exit(), crash)
154  // printf("SharedMem: destructor called for %s\n", m_strbuf);
155 }

The documentation for this class was generated from the following files: