From: Emilio G. Cota Date: Mon, 24 Aug 2015 00:23:40 +0000 (-0400) Subject: qemu-thread: handle spurious futex_wait wakeups X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=16ef9d0252318d7e32e445fd7474af55dbaab7db;p=qemu.git qemu-thread: handle spurious futex_wait wakeups Signed-off-by: Emilio G. Cota Message-Id: <1440375847-17603-12-git-send-email-cota@braap.org> Signed-off-by: Paolo Bonzini --- diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index ba67cec62b..d529405f53 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -298,7 +298,16 @@ static inline void futex_wake(QemuEvent *ev, int n) static inline void futex_wait(QemuEvent *ev, unsigned val) { - futex(ev, FUTEX_WAIT, (int) val, NULL, NULL, 0); + while (futex(ev, FUTEX_WAIT, (int) val, NULL, NULL, 0)) { + switch (errno) { + case EWOULDBLOCK: + return; + case EINTR: + break; /* get out of switch and retry */ + default: + abort(); + } + } } #else static inline void futex_wake(QemuEvent *ev, int n)