A detailed description of how the signal catching works is in the recipe Handling operating system signals.