Added the thread pool (w/Pthreads)

This commit is contained in:
2014-08-05 20:52:17 +01:00
parent 257ce14115
commit d14fd16446
11 changed files with 308 additions and 15 deletions

View File

@@ -75,4 +75,14 @@ queue_item* queue_fetchone(queue *q, bool blocking) {
}
QUEUE_UNLOCK(q);
return item;
}
void queue_clear(queue *q) {
QUEUE_LOCK(q);
queue_item *elem, *tmp;
DL_FOREACH_SAFE(q->list, elem, tmp) {
queue_item_delete(elem);
DL_DELETE(q->list, elem);
}
pthread_cond_broadcast(q->cond);
QUEUE_UNLOCK(q);
}