wait_more:
i++;
- main_loop_wait(10); /* miliseconds */
+ main_loop_wait(true);
xfb = xen_be_find_xendev("vfb", domid, 0);
xin = xen_be_find_xendev("vkbd", domid, 0);
if (!xfb || !xin) {
- if (i < 256)
+ if (i < 256) {
+ usleep(10000);
goto wait_more;
+ }
xen_be_printf(NULL, 1, "displaystate setup failed\n");
return;
}
void qemu_announce_self(void);
-void main_loop_wait(int timeout);
+void main_loop_wait(int nonblocking);
int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
int shared);
};
static struct qemu_alarm_timer *alarm_timer;
+static int qemu_calculate_timeout(void);
static inline int qemu_alarm_pending(void)
{
return NULL;
}
-static void tcg_cpu_exec(void);
+static bool tcg_cpu_exec(void);
static void *tcg_cpu_thread_fn(void *arg)
{
}
#endif
-void main_loop_wait(int timeout)
+void main_loop_wait(int nonblocking)
{
IOHandlerRecord *ioh;
fd_set rfds, wfds, xfds;
int ret, nfds;
struct timeval tv;
+ int timeout;
- qemu_bh_update_timeout(&timeout);
+ if (nonblocking)
+ timeout = 0;
+ else {
+ timeout = qemu_calculate_timeout();
+ qemu_bh_update_timeout(&timeout);
+ }
host_main_loop_wait(&timeout);
return ret;
}
-static void tcg_cpu_exec(void)
+static bool tcg_cpu_exec(void)
{
int ret = 0;
break;
}
}
+ return tcg_has_work();
}
static int qemu_calculate_timeout(void)
if (!vm_running)
timeout = 5000;
- else if (tcg_has_work())
- timeout = 0;
else {
/* XXX: use timeout computed from timers */
int64_t add;
for (;;) {
do {
+ bool nonblocking = false;
#ifdef CONFIG_PROFILER
int64_t ti;
#endif
#ifndef CONFIG_IOTHREAD
- tcg_cpu_exec();
+ nonblocking = tcg_cpu_exec();
#endif
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
- main_loop_wait(qemu_calculate_timeout());
+ main_loop_wait(nonblocking);
#ifdef CONFIG_PROFILER
dev_time += profile_getclock() - ti;
#endif