From: Philippe Mathieu-Daudé <f4...@amsat.org> We are going to extract common pattern from rr_start_vcpu_thread(). First extract the rr_create_vcpu_thread_precheck() helper.
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- accel/tcg/tcg-accel-ops-rr.c | 7 +++++++ accel/tcg/tcg-accel-ops-rr.h | 1 + 2 files changed, 8 insertions(+) diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index de8af32af7..3da684b8e6 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -272,6 +272,13 @@ static void *rr_cpu_thread_fn(void *arg) return NULL; } +static QemuThread *single_tcg_cpu_thread; + +bool rr_create_vcpu_thread_precheck(CPUState *cpu) +{ + return !single_tcg_cpu_thread; +} + void rr_start_vcpu_thread(CPUState *cpu) { char thread_name[VCPU_THREAD_NAME_SIZE]; diff --git a/accel/tcg/tcg-accel-ops-rr.h b/accel/tcg/tcg-accel-ops-rr.h index 54f6ae6e86..e2273b66d4 100644 --- a/accel/tcg/tcg-accel-ops-rr.h +++ b/accel/tcg/tcg-accel-ops-rr.h @@ -15,6 +15,7 @@ /* Kick all RR vCPUs. */ void rr_kick_vcpu_thread(CPUState *unused); +bool rr_create_vcpu_thread_precheck(CPUState *cpu); /* start the round robin vcpu thread */ void rr_start_vcpu_thread(CPUState *cpu); -- 2.35.1