Man page for signal states: "The effects of signal() in a multithreaded process are unspecified." Switch signal() to sigaction in virsh console code.
Move the function to virsh.c to the rest of the TTY managing functions and change the code so that it mirrors the rest.