do proper cpu_self check
commite5bc201df7e060bc4c2912258a77c53f8901356c
authorGlauber Costa <glommer@mothafucka.localdomain>
Mon, 28 Sep 2009 18:27:44 +0000 (28 15:27 -0300)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 5 Oct 2009 14:32:44 +0000 (5 09:32 -0500)
treed85e3178a7a5d6eebbbca9688ac08886cf8db126
parent47cbc7aa5e942f7529b88568dc9bd1e71637ad3a
do proper cpu_self check

Currently, our check for qemu_cpu_self only checks if there is a cpu
currently in execution (represented by cpu_single_env being set). While
this might be okay for tcg, it is certainly not okay for kvm, since multiple
cpus might be executing.

Instead, I propose we use pthread primitives to test if the caller thread is
the same as env->thread.

For tcg, it will have the same semantics as before, since all CPUStates will
point to the same thread, and we'll only have one in execution at a time.

Signed-off-by: Glauber Costa <glommer@mothafucka.localdomain>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vl.c