Lines Matching refs:cq
205 static void cq_init(CQ *cq) { in cq_init() argument
206 pthread_mutex_init(&cq->lock, NULL); in cq_init()
207 cq->head = NULL; in cq_init()
208 cq->tail = NULL; in cq_init()
216 static CQ_ITEM *cq_pop(CQ *cq) { in cq_pop() argument
219 pthread_mutex_lock(&cq->lock); in cq_pop()
220 item = cq->head; in cq_pop()
222 cq->head = item->next; in cq_pop()
223 if (NULL == cq->head) in cq_pop()
224 cq->tail = NULL; in cq_pop()
226 pthread_mutex_unlock(&cq->lock); in cq_pop()
234 static void cq_push(CQ *cq, CQ_ITEM *item) { in cq_push() argument
237 pthread_mutex_lock(&cq->lock); in cq_push()
238 if (NULL == cq->tail) in cq_push()
239 cq->head = item; in cq_push()
241 cq->tail->next = item; in cq_push()
242 cq->tail = item; in cq_push()
243 pthread_mutex_unlock(&cq->lock); in cq_push()