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
int rb_create | ( | int | size, |
int | max_event_size, | ||
int * | handle | ||
) |
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 17303 of file midas.cxx.
int rb_delete | ( | int | handle | ) |
int rb_get_buffer_level | ( | int | handle, |
int * | n_bytes | ||
) |
Return number of bytes in a ring buffer
handle | Handle of the buffer to get the info |
*n_bytes | Number of bytes in buffer |
int rb_get_rp | ( | int | handle, |
void ** | p, | ||
int | millisec | ||
) |
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 17535 of file midas.cxx.
int rb_get_wp | ( | int | handle, |
void ** | p, | ||
int | millisec | ||
) |
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 17394 of file midas.cxx.
int rb_increment_rp | ( | int | handle, |
int | size | ||
) |
int rb_increment_wp | ( | int | handle, |
int | size | ||
) |
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 17469 of file midas.cxx.
int rb_set_nonblocking | ( | void | ) |
|
static |