benchmark/gem_latency: sync startup correctly

When waiting for the producers to start, use the cond/mutex of the
Nth producer and not always the first.

Spotted-by: "Goel, Akash" <akash.goel@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-04-27 17:59:40 +01:00
parent 4a62f0b43f
commit 79f804e8d8

View File

@ -471,10 +471,10 @@ static int run(int seconds,
pthread_create(&p[n].consumers[m].thread, NULL,
consumer, &p[n].consumers[m]);
}
pthread_mutex_lock(&p->lock);
while (p->wait)
pthread_cond_wait(&p->p_cond, &p->lock);
pthread_mutex_unlock(&p->lock);
pthread_mutex_lock(&p[n].lock);
while (p[n].wait)
pthread_cond_wait(&p[n].p_cond, &p[n].lock);
pthread_mutex_unlock(&p[n].lock);
}
pthread_attr_init(&attr);