diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-08-18 06:24:34 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-09-09 15:34:53 +0200 |
commit | 9373e63297c43752f9cf085feb7f5aed57d959f8 (patch) | |
tree | 919c88a38aadb45780cdb143415011e39f63edc9 /cpus.c | |
parent | 5039d6e23586fe6bbedc5e4fe302b48a66890ade (diff) |
tcg: introduce tcg_current_cpu
This is already useful on Windows in order to remove tls.h, because
accesses to current_cpu are done from a different thread on that
platform. It will be used on POSIX platforms as soon TCG stops using
signals to interrupt the execution of translated code.
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r-- | cpus.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -663,8 +663,9 @@ static void cpu_handle_guest_debug(CPUState *cpu) static void cpu_signal(int sig) { - if (current_cpu) { - cpu_exit(current_cpu); + CPUState *cpu = atomic_mb_read(&tcg_current_cpu); + if (cpu) { + cpu_exit(cpu); } exit_request = 1; } |