diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2015-05-08 20:38:00 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-05-08 21:24:02 +0200 |
commit | 598adc5c9c1cfd3f154f6d9df72b38eda63e306e (patch) | |
tree | 8ae8c800e928e875065ef452541a45e201da32c4 /tools/perf/bench/futex-wake.c | |
parent | perf bench futex: Support parallel waker threads (diff) | |
download | linux-598adc5c9c1cfd3f154f6d9df72b38eda63e306e.tar.xz linux-598adc5c9c1cfd3f154f6d9df72b38eda63e306e.zip |
perf bench futex: Handle spurious wakeups
Wrap futex_wait around a loop and catch for EINTR.
Either a spurious wakeup occurred or a signal interrupted is, either way
we need to block again.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Davidlohr Bueso <dbueso@suse.de>
Link: http://lkml.kernel.org/r/1431110280-20231-2-git-send-email-dave@stgolabs.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/bench/futex-wake.c')
-rw-r--r-- | tools/perf/bench/futex-wake.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c index 929f762be47e..e5e41d3bdce7 100644 --- a/tools/perf/bench/futex-wake.c +++ b/tools/perf/bench/futex-wake.c @@ -60,7 +60,12 @@ static void *workerfn(void *arg __maybe_unused) pthread_cond_wait(&thread_worker, &thread_lock); pthread_mutex_unlock(&thread_lock); - futex_wait(&futex1, 0, NULL, futex_flag); + while (1) { + if (futex_wait(&futex1, 0, NULL, futex_flag) != EINTR) + break; + } + + pthread_exit(NULL); return NULL; } |