Implemented pre_term_timeout including test

Implements the same functionality but includes a test of the signal handling to make sure things are working properly.

See https://github.com/resque/resque/pull/1136 for a description of the use case for this code.