提交 b022b4a4 编写于 作者: P Paolo Bonzini 提交者: Anthony Liguori

aio: avoid livelock behavior for Win32

The repeated calls to WaitForMultipleObjects may cause a livelock in aio_poll,
where no progress is made on bottom halves.  This patch matches the behavior
of the POSIX code.
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 21022c92
...@@ -173,7 +173,7 @@ bool aio_poll(AioContext *ctx, bool blocking) ...@@ -173,7 +173,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
} }
/* wait until next event */ /* wait until next event */
for (;;) { while (count > 0) {
int timeout = blocking ? INFINITE : 0; int timeout = blocking ? INFINITE : 0;
int ret = WaitForMultipleObjects(count, events, FALSE, timeout); int ret = WaitForMultipleObjects(count, events, FALSE, timeout);
...@@ -209,6 +209,9 @@ bool aio_poll(AioContext *ctx, bool blocking) ...@@ -209,6 +209,9 @@ bool aio_poll(AioContext *ctx, bool blocking)
g_free(tmp); g_free(tmp);
} }
} }
/* Try again, but only call each handler once. */
events[ret - WAIT_OBJECT_0] = events[--count];
} }
return progress; return progress;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册