4.2.4 qmm_queue_remove Function

C

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

Summary

Removes a buffer from queue.

Description

This function removes a buffer from queue

Precondition

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

Parameters

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

Returns

return - Pointer to the buffer header, if the buffer is successfully removed, 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);
//Remove buffer from queue
app_buf = qmm_queue_remove(&app_queue, NULL);

Remarks

None