aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/main-loop.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/util/main-loop.c b/util/main-loop.c
index 7558eb5..992f9b0 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -29,6 +29,7 @@
#include "qemu/sockets.h" // struct in_addr needed for libslirp.h
#include "sysemu/qtest.h"
#include "sysemu/cpus.h"
+#include "sysemu/replay.h"
#include "slirp/libslirp.h"
#include "qemu/main-loop.h"
#include "block/aio.h"
@@ -245,18 +246,19 @@ static int os_host_main_loop_wait(int64_t timeout)
timeout = SCALE_MS;
}
+
if (timeout) {
spin_counter = 0;
- qemu_mutex_unlock_iothread();
} else {
spin_counter++;
}
+ qemu_mutex_unlock_iothread();
+ replay_mutex_unlock();
ret = qemu_poll_ns((GPollFD *)gpollfds->data, gpollfds->len, timeout);
- if (timeout) {
- qemu_mutex_lock_iothread();
- }
+ replay_mutex_lock();
+ qemu_mutex_lock_iothread();
glib_pollfds_poll();
@@ -463,8 +465,13 @@ static int os_host_main_loop_wait(int64_t timeout)
poll_timeout_ns = qemu_soonest_timeout(poll_timeout_ns, timeout);
qemu_mutex_unlock_iothread();
+
+ replay_mutex_unlock();
+
g_poll_ret = qemu_poll_ns(poll_fds, n_poll_fds + w->num, poll_timeout_ns);
+ replay_mutex_lock();
+
qemu_mutex_lock_iothread();
if (g_poll_ret > 0) {
for (i = 0; i < w->num; i++) {