Implement a signal handler.