Fixed signal handling code incorrectly making use of mutexes within the signal handler