Add an extension hook for connecting to signals.

This introduces SignalHook, which allows extensions to easily connect to
signals and not worry about having to disconnect them. SignalHook takes
care of the initial connection to the signal and the eventual disconnect
on shutdown.