Belle II Software  release-08-01-10
DqmSharedMem Class Reference

Public Member Functions

 DqmSharedMem (const char *name, int size)
 
 DqmSharedMem (int shm_id, int sem_id, int size)
 
 ~DqmSharedMem (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).
 
int m_pathfd
 
key_t m_shmkey
 Associated file descriptor. More...
 
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 DqmSharedMem.h.

Constructor & Destructor Documentation

◆ ~DqmSharedMem()

~DqmSharedMem ( void  )

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

Definition at line 125 of file DqmSharedMem.cc.

126 {
128 
129  //shmdt((const void*) m_shmadr);
130  //shmctl(m_shmid, IPC_RMID, NULL);
131  //printf("DqmSharedMem: destructor called for ID %d\n", m_shmid);
132  // TODO: problem, neither semaphore nor tmp file are deleted if they exist
133  // TODO: there is no guarantee that the destructor is called (e.g. on exit(), crash)
134  // printf("DqmSharedMem: destructor called for %s\n", m_strbuf);
135 }

Member Data Documentation

◆ m_shmkey

key_t m_shmkey
private

Associated file descriptor.

SHM key, see shmget(2).

Definition at line 40 of file DqmSharedMem.h.


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