diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-27 17:59:40 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-27 18:37:35 +0100 |
commit | 79f804e8d89937b16247f6a6b30657e70a9ff722 (patch) | |
tree | b0d9b7a599bdb918d77d5194fb6e340a53a34cf6 /benchmarks/gem_latency.c | |
parent | 4a62f0b43f12c68d86e77fd0529c0f18e6a78ba1 (diff) |
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>
Diffstat (limited to 'benchmarks/gem_latency.c')
-rw-r--r-- | benchmarks/gem_latency.c | 8 |
1 files changed, 4 insertions, 4 deletions
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); |