2
0
Fork 0

[jobqueue] as jobs in the queue could be removed in a callback we can\'t copy the queue to a private one, g_queue_unlink needs the real one

personal/stbuehler/wip
Stefan Bühler 2011-08-09 20:17:13 +02:00
parent 496a28f197
commit 92ca097ed4
1 changed files with 4 additions and 5 deletions

View File

@ -8,17 +8,16 @@ static void job_queue_run(liJobQueue* jq, int loops) {
int i;
for (i = 0; i < loops; i++) {
GQueue q = jq->queue;
GQueue *q = &jq->queue;
GList *l;
liJob *job;
guint todo = q->length;
INC_GEN(jq);
if (q.length == 0) return;
if (0 == todo) return;
g_queue_init(&jq->queue); /* reset queue, elements are in q */
while (NULL != (l = g_queue_pop_head_link(&q))) {
while ((todo-- > 0) && (NULL != (l = g_queue_pop_head_link(q)))) {
job = LI_CONTAINER_OF(l, liJob, link);
job->generation = jq->generation;
job->link.data = NULL;