Revision 16b151c3

b/vl.c
3281 3281
    qemu_notify_event();
3282 3282
}
3283 3283

  
3284
#ifdef CONFIG_IOTHREAD
3285
static void qemu_system_vmstop_request(int reason)
3284
static int cpu_can_run(CPUState *env)
3286 3285
{
3287
    vmstop_requested = reason;
3288
    qemu_notify_event();
3286
    if (env->stop)
3287
        return 0;
3288
    if (env->stopped)
3289
        return 0;
3290
    if (!vm_running)
3291
        return 0;
3292
    return 1;
3293
}
3294

  
3295
static int cpu_has_work(CPUState *env)
3296
{
3297
    if (env->stop)
3298
        return 1;
3299
    if (env->stopped)
3300
        return 0;
3301
    if (!env->halted)
3302
        return 1;
3303
    if (qemu_cpu_has_work(env))
3304
        return 1;
3305
    return 0;
3306
}
3307

  
3308
static int tcg_has_work(void)
3309
{
3310
    CPUState *env;
3311

  
3312
    for (env = first_cpu; env != NULL; env = env->next_cpu)
3313
        if (cpu_has_work(env))
3314
            return 1;
3315
    return 0;
3289 3316
}
3290
#endif
3291 3317

  
3292 3318
#ifndef _WIN32
3293 3319
static int io_thread_fd = -1;
......
3381 3407
}
3382 3408
#endif
3383 3409

  
3384
static int cpu_can_run(CPUState *env)
3385
{
3386
    if (env->stop)
3387
        return 0;
3388
    if (env->stopped)
3389
        return 0;
3390
    if (!vm_running)
3391
        return 0;
3392
    return 1;
3393
}
3394

  
3395 3410
#ifndef CONFIG_IOTHREAD
3396 3411
static int qemu_init_main_loop(void)
3397 3412
{
......
3470 3485
static void tcg_block_io_signals(void);
3471 3486
static void kvm_block_io_signals(CPUState *env);
3472 3487
static void unblock_io_signals(void);
3473
static int tcg_has_work(void);
3474
static int cpu_has_work(CPUState *env);
3475 3488

  
3476 3489
static int qemu_init_main_loop(void)
3477 3490
{
......
3822 3835
    qemu_event_increment();
3823 3836
}
3824 3837

  
3838
static void qemu_system_vmstop_request(int reason)
3839
{
3840
    vmstop_requested = reason;
3841
    qemu_notify_event();
3842
}
3843

  
3825 3844
void vm_stop(int reason)
3826 3845
{
3827 3846
    QemuThread me;
......
4036 4055
    }
4037 4056
}
4038 4057

  
4039
static int cpu_has_work(CPUState *env)
4040
{
4041
    if (env->stop)
4042
        return 1;
4043
    if (env->stopped)
4044
        return 0;
4045
    if (!env->halted)
4046
        return 1;
4047
    if (qemu_cpu_has_work(env))
4048
        return 1;
4049
    return 0;
4050
}
4051

  
4052
static int tcg_has_work(void)
4053
{
4054
    CPUState *env;
4055

  
4056
    for (env = first_cpu; env != NULL; env = env->next_cpu)
4057
        if (cpu_has_work(env))
4058
            return 1;
4059
    return 0;
4060
}
4061

  
4062 4058
static int qemu_calculate_timeout(void)
4063 4059
{
4064 4060
#ifndef CONFIG_IOTHREAD

Also available in: Unified diff