void cache_pop(struct lnode *n) { struct cache_entry *ce = n->data; free(ce->data); free(ce); if (n == cache_list) cache_list = cache_list->next; free(lnode_pop(n)); }
void cache_bump(struct lnode *n) { if (n == cache_list) return; pthread_mutex_lock(&lock); lnode_pop(n); cache_list = lnode_push(cache_list, n); pthread_mutex_unlock(&lock); }
void database_pop(struct lnode *node) { pthread_mutex_lock(&lock); free(node->data); if (node == file_list) file_list = file_list->next; free(lnode_pop(node)); pthread_mutex_unlock(&lock); }
struct client_ctx *queue_pop() { pthread_mutex_lock(&avail_lock); if (!client_queue) pthread_cond_wait(&avail_cond, &avail_lock); struct lnode *n = lnode_pop(listend(client_queue)); struct client_ctx *cc = n->data; queue_size--; free(n); if (n == client_queue) client_queue = 0; pthread_mutex_unlock(&avail_lock); return cc; }