MIDAS
|
Classes | |
struct | RING_BUFFER |
Macros | |
#define | MAX_RING_BUFFER 100 |
Functions | |
int | rb_set_nonblocking () |
int | rb_create (int size, int max_event_size, int *handle) |
int | rb_delete (int handle) |
int | rb_get_wp (int handle, void **p, int millisec) |
int | rb_increment_wp (int handle, int size) |
int | rb_get_rp (int handle, void **p, int millisec) |
int | rb_increment_rp (int handle, int size) |
int | rb_get_buffer_level (int handle, int *n_bytes) |
Variables | |
static RING_BUFFER | rb [MAX_RING_BUFFER] |
static volatile int | _rb_nonblocking = 0 |
dox dox
Create a ring buffer with a given size
Provide an inter-thread buffer scheme for handling front-end events. This code allows concurrent data acquisition, calibration and network transfer on a multi-CPU machine. One thread reads out the data, passes it via the ring buffer functions to another thread running on the other CPU, which can then calibrate and/or send the data over the network.
size | Size of ring buffer, must be larger than 2*max_event_size |
max_event_size | Maximum event size to be placed into |
*handle | Handle to ring buffer |
Definition at line 17336 of file midas.cxx.
Return number of bytes in a ring buffer
handle | Handle of the buffer to get the info |
*n_bytes | Number of bytes in buffer |
Definition at line 17685 of file midas.cxx.
Obtain the current read pointer at which new data is available with optional timeout
handle | Ring buffer handle |
millisec | Optional timeout in milliseconds if buffer is full. Zero to not wait at all (non-blocking) |
**p | Address of pointer pointing to newly available data. If p == NULL, only return status. |
Definition at line 17568 of file midas.cxx.
Retrieve write pointer where new data can be written
handle | Ring buffer handle |
millisec | Optional timeout in milliseconds if buffer is full. Zero to not wait at all (non-blocking) |
**p | Write pointer |
Definition at line 17427 of file midas.cxx.
Increment current read pointer, freeing up space for the writing thread.
handle | Ring buffer handle |
size | Number of bytes to free up at current read pointer |
Definition at line 17630 of file midas.cxx.
rb_increment_wp
Increment current write pointer, making the data at the write pointer available to the receiving thread
handle | Ring buffer handle |
size | Number of bytes placed at the WP |
Definition at line 17502 of file midas.cxx.
|
static |