From 643ecdc9062ed5cd16de2f6d57b4b0c66a6bb85b Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Thu, 29 Jun 2023 16:47:30 +0800 Subject: [PATCH] add functions sorted_queue_lock and sorted_queue_unlock --- src/sorted_queue.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sorted_queue.h b/src/sorted_queue.h index 70e521f..9647622 100644 --- a/src/sorted_queue.h +++ b/src/sorted_queue.h @@ -20,6 +20,7 @@ #include "fast_mblock.h" #include "fc_list.h" +#include "pthread_func.h" struct sorted_queue { @@ -115,6 +116,16 @@ static inline bool sorted_queue_empty(struct sorted_queue *sq) int sorted_queue_free_chain(struct sorted_queue *sq, struct fast_mblock_man *mblock, struct fc_list_head *head); +static inline void sorted_queue_lock(struct sorted_queue *sq) +{ + PTHREAD_MUTEX_LOCK(&sq->lcp.lock); +} + +static inline void sorted_queue_unlock(struct sorted_queue *sq) +{ + PTHREAD_MUTEX_UNLOCK(&sq->lcp.lock); +} + #ifdef __cplusplus } #endif