Skip to content
Snippets Groups Projects
Commit 979e6f21 authored by Rob Davies's avatar Rob Davies
Browse files

Only broadcast result_avail if it's the next one to be picked up

Reduces the number of times the output consumer will be woken
up, only to be disappointed.
parent 699ed53d
Branches
No related tags found
No related merge requests found
......@@ -111,10 +111,14 @@ static int hts_tpool_add_result(hts_tpool_job *j, void *data) {
q->output_head = q->output_tail = r;
}
assert(r->serial >= q->next_serial // Or it will never be dequeued ...
|| q->next_serial == INT_MAX); // ... unless flush in progress.
if (r->serial == q->next_serial) {
DBG_OUT(stderr, "%d: Broadcasting result_avail (id %"PRId64")\n",
worker_id(j->p), r->serial);
pthread_cond_broadcast(&q->output_avail_c);
DBG_OUT(stderr, "%d: Broadcast complete\n", worker_id(j->p));
}
pthread_mutex_unlock(&q->p->pool_m);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment