From 79f804e8d89937b16247f6a6b30657e70a9ff722 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 27 Apr 2016 17:59:40 +0100 Subject: 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" Signed-off-by: Chris Wilson --- benchmarks/gem_latency.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'benchmarks/gem_latency.c') diff --git a/benchmarks/gem_latency.c b/benchmarks/gem_latency.c index 27d286c4..1106695c 100644 --- a/benchmarks/gem_latency.c +++ b/benchmarks/gem_latency.c @@ -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); -- cgit v1.2.3