summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-10-30 15:50:12 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-10-30 15:51:21 +0000
commitce65232cf5039798045767c65f2110f3b2a8ffd0 (patch)
tree8f54e648f77d8bc32a625ec4a1a720cd7b1d38ea /benchmarks
parent9024a72d29150f05e2ad62aa088d19a662bbf815 (diff)
benchmarks/gem_wait: Remove pthread_cancel()
Apparently the pthread shim on Android doesn't have pthread cancellation, so use the plain old volatile to terminate the CPU hogs. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/gem_wait.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/benchmarks/gem_wait.c b/benchmarks/gem_wait.c
index 912ffadc..6ebee50a 100644
--- a/benchmarks/gem_wait.c
+++ b/benchmarks/gem_wait.c
@@ -246,14 +246,14 @@ static void waiter(int child)
close(fd);
}
+static volatile int done;
+
static void *thread(void *arg)
{
- uint64_t *c = arg;
-
- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+ volatile uint64_t *c = arg;
- while (1)
- __sync_fetch_and_add(c, 1);
+ while (!done)
+ ++*c;
return NULL;
}
@@ -272,12 +272,13 @@ static int run(int num_waiters)
waiter(child);
igt_waitchildren();
+ done = 1;
+ for (int n = 0; n < num_cpus; n++)
+ pthread_join(threads[n], NULL);
+
count = 0;
- for (int n = 0; n < num_cpus; n++) {
- pthread_cancel(threads[n]);
- __sync_synchronize();
+ for (int n = 0; n < num_cpus; n++)
count += counters[8*n];
- }
printf("%llu\n", (long long unsigned)count);
return 0;