Use the signal stack pointer to determine the current thread. Converted the SIGUSR2 handler to use setup_exception (probably still not working properly).