You will do yourself a lot of good, by reading all the available documentation on signal handlers BEFORE you start to work with them. They can be dangerous and they can cause unexpected behaviour under the right circumstances. In short, do not do anymore than absolutely necessary in the signal handler (re: only set a previously defined/initialized variable.) The simpler the better. The level of danger varies from platform to platform. While I've never used
POSIX signals I've heard they are safer.
Just my $.02, I could be wrong.