 |
Belle II Software
release-05-02-19
|
Go to the documentation of this file.
47 explicit RingBuffer(
const std::string& name,
unsigned int nwords = 0);
56 int insq(
const int* buf,
int size,
bool checkTx =
false);
60 int spyq(
int* buf)
const;
bool isDead() const
If True, the ring buffer is empty and has no attached Tx modules (i.e.
int m_shmsize
Size of shared memory segment, in bytes.
int clear()
Clear the RingBuffer.
int prevwptr
Previous state of wptr (for error recovery).
int size
ring buffer size (integers), minus this header.
int m_insq_counter
count insq() calls.
void txAttached()
Increase the number of attached Tx counter.
int nremq
Count remq() calls for this buffer.
int errtype
Error state? 0: Normal, 1: buffer full and wptr>rptr, others are complicated.
int numAttachedTx
number of attached sending processes.
int nattached
Number of RingBuffer instances currently attached to this buffer.
bool m_new
True if we created the ring buffer ourselves (and need to clean it).
RingBuffer(int nwords=c_DefaultSize)
Constructor to create a new shared memory in private space.
void cleanup()
Function to detach and remove shared memory.
int m_pathfd
Associated file descriptor.
int tryClear()
Clear the RingBuffer, if the semaphore isn't locked at the moment.
key_t m_semkey
Semaphore key, see semget(2).
bool allRxWaiting() const
True if and only if buffer is empty and nbusy == 0.
void openSHM(int nwords)
open shared memory
int insq_counter() const
Return number of insq() calls.
int numq() const
Returns number of entries/buffers in the RingBuffer.
int nremq() const
Return number of remq() calls for current buffer.
int nbuf
Number of entries in ring buffer.
key_t m_shmkey
SHM key, see shmget(2).
int m_remq_counter
count remq() calls.
Class to manage a Ring Buffer placed in an IPC shared memory.
struct RingBufInfo * m_bufinfo
structure to manage ring buffer.
Internal metadata structure for RingBuffer.
int * m_shmadr
Address of attached shared memory segment.
int ninsq() const
Return number of insq() calls for current buffer.
std::string m_pathname
Path for identifying shared memory if named ring buffer is created.
Abstract base class for different kinds of events.
void txDetached()
Decrease the number of attached Tx counter.
int * m_buftop
Points to memory after the end of m_bufinfo.
void kill()
Cause termination of reading processes (if they use isDead()).
int remain
Unsure, always equal to size.
int wptr
Pointer for writing entries.
const static int c_DefaultSize
Standard size of buffer, in integers (~60MB).
int ninsq
Count insq() calls for this buffer.
std::string m_semshmFileName
file path containing ids of shm and sema for private shared mem, used for easier cleanup if we fail t...
void forceClear()
Forcefully clear the RingBuffer with resetting semaphore.
int m_shmid
ID of shared memory segment.
int rptr
Pointer for reading entries.
void dumpInfo() const
Dump contents of RingBufInfo metadata.
void dump_db()
Print some info on the RingBufInfo structure.
int spyq(int *buf) const
Prefetch a buffer from the RingBuffer w/o removing it.
int remq(int *buf)
Pick up a buffer from the RingBuffer.
bool m_file
True if m_pathfd needs to be closed.
bool m_procIsBusy
Is this process currently processing events from this RingBuffer?
int insq(const int *buf, int size, bool checkTx=false)
Append a buffer to the RingBuffer.
int nbusy
Number of attached reading processes currently processing events.
int shmid() const
Return ID of the shared memory.
int remq_counter() const
Return number of remq() calls.