mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-08 00:16:18 +00:00
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>
This commit is contained in:
parent
9024a72d29
commit
ce65232cf5
@ -246,14 +246,14 @@ static void waiter(int child)
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static volatile int done;
|
||||
|
||||
static void *thread(void *arg)
|
||||
{
|
||||
uint64_t *c = arg;
|
||||
volatile uint64_t *c = arg;
|
||||
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user