add function fc_queue_pop_to_queue_ex
parent
d5fd9a176d
commit
48f108b40d
1
HISTORY
1
HISTORY
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
Version 1.52 2021-06-01
|
Version 1.52 2021-06-01
|
||||||
* process_stop more gracefully (kill -9 on timeout)
|
* process_stop more gracefully (kill -9 on timeout)
|
||||||
|
* add function fc_queue_pop_to_queue_ex
|
||||||
|
|
||||||
Version 1.51 2021-05-27
|
Version 1.51 2021-05-27
|
||||||
* fast_mblock.[hc]: support batch alloc and batch free
|
* fast_mblock.[hc]: support batch alloc and batch free
|
||||||
|
|
|
||||||
|
|
@ -155,10 +155,16 @@ void fc_queue_push_queue_to_tail_ex(struct fc_queue *queue,
|
||||||
PTHREAD_MUTEX_UNLOCK(&queue->lc_pair.lock);
|
PTHREAD_MUTEX_UNLOCK(&queue->lc_pair.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fc_queue_pop_to_queue(struct fc_queue *queue,
|
void fc_queue_pop_to_queue_ex(struct fc_queue *queue,
|
||||||
struct fc_queue_info *qinfo)
|
struct fc_queue_info *qinfo, const bool blocked)
|
||||||
{
|
{
|
||||||
PTHREAD_MUTEX_LOCK(&queue->lc_pair.lock);
|
PTHREAD_MUTEX_LOCK(&queue->lc_pair.lock);
|
||||||
|
if (queue->head == NULL) {
|
||||||
|
if (blocked) {
|
||||||
|
pthread_cond_wait(&queue->lc_pair.cond, &queue->lc_pair.lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (queue->head != NULL) {
|
if (queue->head != NULL) {
|
||||||
qinfo->head = queue->head;
|
qinfo->head = queue->head;
|
||||||
qinfo->tail = queue->tail;
|
qinfo->tail = queue->tail;
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,14 @@ void *fc_queue_pop_all_ex(struct fc_queue *queue, const bool blocked);
|
||||||
#define fc_queue_pop_all(queue) fc_queue_pop_all_ex(queue, true)
|
#define fc_queue_pop_all(queue) fc_queue_pop_all_ex(queue, true)
|
||||||
#define fc_queue_try_pop_all(queue) fc_queue_pop_all_ex(queue, false)
|
#define fc_queue_try_pop_all(queue) fc_queue_pop_all_ex(queue, false)
|
||||||
|
|
||||||
void fc_queue_pop_to_queue(struct fc_queue *queue,
|
void fc_queue_pop_to_queue_ex(struct fc_queue *queue,
|
||||||
struct fc_queue_info *qinfo);
|
struct fc_queue_info *qinfo, const bool blocked);
|
||||||
|
|
||||||
|
#define fc_queue_pop_to_queue(queue, qinfo) \
|
||||||
|
fc_queue_pop_to_queue_ex(queue, qinfo, true)
|
||||||
|
|
||||||
|
#define fc_queue_try_pop_to_queue(queue, qinfo) \
|
||||||
|
fc_queue_pop_to_queue_ex(queue, qinfo, false)
|
||||||
|
|
||||||
static inline bool fc_queue_empty(struct fc_queue *queue)
|
static inline bool fc_queue_empty(struct fc_queue *queue)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -840,7 +840,7 @@ static void sched_deal_task_queue(ScheduleContext *pContext)
|
||||||
FastDelayTask *task;
|
FastDelayTask *task;
|
||||||
struct fc_queue_info qinfo;
|
struct fc_queue_info qinfo;
|
||||||
|
|
||||||
fc_queue_pop_to_queue(&pContext->delay_queue, &qinfo);
|
fc_queue_try_pop_to_queue(&pContext->delay_queue, &qinfo);
|
||||||
task = qinfo.head;
|
task = qinfo.head;
|
||||||
while (task != NULL)
|
while (task != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue