Revision d6f4ade2

b/hw/xenfb.c
983 983

  
984 984
wait_more:
985 985
    i++;
986
    main_loop_wait(10); /* miliseconds */
986
    main_loop_wait(true);
987 987
    xfb = xen_be_find_xendev("vfb", domid, 0);
988 988
    xin = xen_be_find_xendev("vkbd", domid, 0);
989 989
    if (!xfb || !xin) {
990
        if (i < 256)
990
        if (i < 256) {
991
            usleep(10000);
991 992
            goto wait_more;
993
        }
992 994
        xen_be_printf(NULL, 1, "displaystate setup failed\n");
993 995
        return;
994 996
    }
b/sysemu.h
64 64

  
65 65
void qemu_announce_self(void);
66 66

  
67
void main_loop_wait(int timeout);
67
void main_loop_wait(int nonblocking);
68 68

  
69 69
int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
70 70
                            int shared);
b/vl.c
618 618
};
619 619

  
620 620
static struct qemu_alarm_timer *alarm_timer;
621
static int qemu_calculate_timeout(void);
621 622

  
622 623
static inline int qemu_alarm_pending(void)
623 624
{
......
3596 3597
    return NULL;
3597 3598
}
3598 3599

  
3599
static void tcg_cpu_exec(void);
3600
static bool tcg_cpu_exec(void);
3600 3601

  
3601 3602
static void *tcg_cpu_thread_fn(void *arg)
3602 3603
{
......
3914 3915
}
3915 3916
#endif
3916 3917

  
3917
void main_loop_wait(int timeout)
3918
void main_loop_wait(int nonblocking)
3918 3919
{
3919 3920
    IOHandlerRecord *ioh;
3920 3921
    fd_set rfds, wfds, xfds;
3921 3922
    int ret, nfds;
3922 3923
    struct timeval tv;
3924
    int timeout;
3923 3925

  
3924
    qemu_bh_update_timeout(&timeout);
3926
    if (nonblocking)
3927
        timeout = 0;
3928
    else {
3929
        timeout = qemu_calculate_timeout();
3930
        qemu_bh_update_timeout(&timeout);
3931
    }
3925 3932

  
3926 3933
    host_main_loop_wait(&timeout);
3927 3934

  
......
4028 4035
    return ret;
4029 4036
}
4030 4037

  
4031
static void tcg_cpu_exec(void)
4038
static bool tcg_cpu_exec(void)
4032 4039
{
4033 4040
    int ret = 0;
4034 4041

  
......
4053 4060
            break;
4054 4061
        }
4055 4062
    }
4063
    return tcg_has_work();
4056 4064
}
4057 4065

  
4058 4066
static int qemu_calculate_timeout(void)
......
4062 4070

  
4063 4071
    if (!vm_running)
4064 4072
        timeout = 5000;
4065
    else if (tcg_has_work())
4066
        timeout = 0;
4067 4073
    else {
4068 4074
     /* XXX: use timeout computed from timers */
4069 4075
        int64_t add;
......
4123 4129

  
4124 4130
    for (;;) {
4125 4131
        do {
4132
            bool nonblocking = false;
4126 4133
#ifdef CONFIG_PROFILER
4127 4134
            int64_t ti;
4128 4135
#endif
4129 4136
#ifndef CONFIG_IOTHREAD
4130
            tcg_cpu_exec();
4137
            nonblocking = tcg_cpu_exec();
4131 4138
#endif
4132 4139
#ifdef CONFIG_PROFILER
4133 4140
            ti = profile_getclock();
4134 4141
#endif
4135
            main_loop_wait(qemu_calculate_timeout());
4142
            main_loop_wait(nonblocking);
4136 4143
#ifdef CONFIG_PROFILER
4137 4144
            dev_time += profile_getclock() - ti;
4138 4145
#endif

Also available in: Unified diff