Free jobs as soon as possible

This commit is contained in:
Laurent Fasnacht 2014-05-13 14:22:03 +02:00
parent 63adb54a3d
commit d4a303e7e6

View file

@ -234,8 +234,6 @@ int threadqueue_finalize(threadqueue_queue * const threadqueue) {
return 1; return 1;
} }
int threadqueue_flush(threadqueue_queue * const threadqueue) { int threadqueue_flush(threadqueue_queue * const threadqueue) {
int notdone = 1; int notdone = 1;
int i; int i;
@ -273,12 +271,13 @@ int threadqueue_flush(threadqueue_queue * const threadqueue) {
} }
} while (notdone > 0); } while (notdone > 0);
if (0) { //technically not needed #if 1
for (i=0; i < threadqueue->queue_count; ++i) { //technically not needed, but spares memory. On the other hand, it makes debugging harder.
FREE_POINTER(threadqueue->queue[i]); for (i=0; i < threadqueue->queue_count; ++i) {
} FREE_POINTER(threadqueue->queue[i]);
threadqueue->queue_count = 0;
} }
threadqueue->queue_count = 0;
#endif
assert(threadqueue->queue_waiting == 0); assert(threadqueue->queue_waiting == 0);
PTHREAD_UNLOCK(&threadqueue->lock); PTHREAD_UNLOCK(&threadqueue->lock);