add functions sorted_queue_lock and sorted_queue_unlock

pull/47/head
YuQing 2023-06-29 16:47:30 +08:00
parent 7726d0223f
commit 643ecdc906
1 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include "fast_mblock.h" #include "fast_mblock.h"
#include "fc_list.h" #include "fc_list.h"
#include "pthread_func.h"
struct sorted_queue 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, int sorted_queue_free_chain(struct sorted_queue *sq,
struct fast_mblock_man *mblock, struct fc_list_head *head); 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 #ifdef __cplusplus
} }
#endif #endif