diff --git a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp index 56661b33d..eff8ca97d 100644 --- a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp +++ b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp @@ -33,6 +33,16 @@ inline int mc_lqueue_item_size(struct mc_lqueue_item* q_item) return q_item->element.data->iov_len; } +/* +function name: mc_lqueue_add +description: Add an element to a specific queue. +arguments: The first parameter is a pointer of type (mc_lqueue *), whose member variable list points to the target queue. + The second parameter points to the element to be added to the queue. +return value: Returns 1 if the element is successfully added to the queue, otherwise returns - 1. +note: none +date: 2022/8/13 +contact tel: 18720816902 +*/ int mc_lqueue_add(struct mc_lqueue* q, struct mc_lqueue_item* q_item) { if (q == NULL || q_item == NULL) { @@ -60,6 +70,17 @@ int mc_lqueue_add(struct mc_lqueue* q, struct mc_lqueue_item* q_item) return 1; } +/* +function name: mc_lqueue_remove +description: Remove the head element in a specific queue. +arguments: The first parameter is a pointer of type (mc_lqueue *), whose member variable list points to the target queue. + The second parameter points to the queue head element used to store the removal from the queue. +return value: Return NULL if an error occurs during the removal of the queue head element, otherwise a pointer to + the successfully removed queue head element is returned. +note: none +date: 2022/8/13 +contact tel: 18720816902 +*/ struct mc_lqueue_item* mc_lqueue_remove(struct mc_lqueue* q, struct mc_lqueue_item* q_item) { if (q == NULL) { @@ -89,6 +110,18 @@ struct mc_lqueue_item* mc_lqueue_remove(struct mc_lqueue* q, struct mc_lqueue_it return q_item; } +/* +function name: mc_lqueue_init +description: This function is used to open an area in the memory area. One part of the area is used to store a queue with + a certain specification, and the other part is used to store the information of the queue, such as the specification + and the number of elements. Finally, a pointer to the area is returned. +arguments: This parameter specifies that the maximum number of elements that the queue can hold is size, but this does + not mean that the size of the queue is so large at the beginning. +return value: If the function runs successfully, it returns a pointer to the opened memory area; otherwise, it returns NULL. +note: none +date: 2022/8/13 +contact tel: 18720816902 +*/ struct mc_lqueue* mc_lqueue_init(unsigned long size) { if (size == 0) {