On 3/23/22 10:17, Philippe Mathieu-Daudé wrote:
+void rr_create_vcpu_thread_postcheck(CPUState *cpu)
{
- char thread_name[VCPU_THREAD_NAME_SIZE];
static QemuCond *single_tcg_halt_cond;
- static QemuThread *single_tcg_cpu_thread;
-
- if (!single_tcg_cpu_thread) {
- cpu->thread = g_new0(QemuThread, 1);
- cpu->halt_cond = g_new0(QemuCond, 1);
- qemu_cond_init(cpu->halt_cond);
-
- /* share a single thread for all cpus with TCG */
- snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "ALL CPUs/TCG");
- qemu_thread_create(cpu->thread, thread_name,
- rr_cpu_thread_fn,
- cpu, QEMU_THREAD_JOINABLE);
+ if (! single_tcg_cpu_thread) {
single_tcg_halt_cond = cpu->halt_cond;
single_tcg_cpu_thread = cpu->thread;
-#ifdef _WIN32
- cpu->hThread = qemu_thread_get_handle(cpu->thread);
-#endif
} else {
/* we share the thread */
cpu->thread = single_tcg_cpu_thread;
This doesn't treat cpu->halt_cond correctly for other than the first cpu.
r~