4.2.3 qmm_queue_read Function

C

buffer_t* qmm_queue_read(queue_t *q, search_t *search)

Summary

Reads a buffer from queue

Description

This function reads either the first buffer if search is NULL or buffer matching the given criteria from queue.

Precondition

qmm_queue_init should have called for initilazing the particular queue before using it and buffer should be appended before reading it

Parameters

ParamDescription
qQueue from which buffer should be read
searchSearch criteria. If this parameter is NULL, first buffer in the queue will be read. Otherwise buffer matching the criteria will be read

Returns

return - Pointer to the buffer header, if the buffer is successfully read, NULL otherwise.

Example

queue_t app_queue;
buffer_t *app_buf;
// Allocate the buffer
app_buf = bmm_buffer_alloc(LARGE_BUFFER_SIZE);

uint8_t queue_size = 10;
qmm_queue_init(&app_queue, queue_size);
// Append buffer in queue
qmm_queue_append(&app_queue, app_buf);
//Read buffer from queue
app_buf = qmm_queue_read(&app_queue, NULL);

Remarks

None