mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-15 05:11:32 +00:00
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>
This commit is contained in:
parent
d65817b4e7
commit
598adc5c9c
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user