X_EXTERN void X_PFX (list_free_1) (x_list *node) { assert (node != NULL); pthread_mutex_lock (&freelist_lock); list_free_1 (node); pthread_mutex_unlock (&freelist_lock); }
X_EXTERN void X_PFX (list_free) (x_list *lst) { x_list *next; pthread_mutex_lock (&freelist_lock); for (; lst != NULL; lst = next) { next = lst->next; list_free_1 (lst); } pthread_mutex_unlock (&freelist_lock); }
void *queue_pop(UQueue *queue) { UList *list; void *data; if (!queue || !queue->head) return NULL; list = queue->head; data = list->data; queue->head = list->next; if (--queue->size == 0) queue->tail = NULL; list_free_1(list); return data; }