From d4a303e7e6dfe63569ed5f670634ce829ab5ad5e Mon Sep 17 00:00:00 2001 From: Laurent Fasnacht Date: Tue, 13 May 2014 14:22:03 +0200 Subject: [PATCH] Free jobs as soon as possible --- src/threadqueue.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/threadqueue.c b/src/threadqueue.c index 699428af..5c2f9108 100644 --- a/src/threadqueue.c +++ b/src/threadqueue.c @@ -234,8 +234,6 @@ int threadqueue_finalize(threadqueue_queue * const threadqueue) { return 1; } - - int threadqueue_flush(threadqueue_queue * const threadqueue) { int notdone = 1; int i; @@ -273,12 +271,13 @@ int threadqueue_flush(threadqueue_queue * const threadqueue) { } } while (notdone > 0); - if (0) { //technically not needed - for (i=0; i < threadqueue->queue_count; ++i) { - FREE_POINTER(threadqueue->queue[i]); - } - threadqueue->queue_count = 0; +#if 1 + //technically not needed, but spares memory. On the other hand, it makes debugging harder. + for (i=0; i < threadqueue->queue_count; ++i) { + FREE_POINTER(threadqueue->queue[i]); } + threadqueue->queue_count = 0; +#endif assert(threadqueue->queue_waiting == 0); PTHREAD_UNLOCK(&threadqueue->lock);