signal() and sigsetjmp()

Hi,

I am basically new to signals in UNIX. My question is, should the signal() command be called only once in the program? What will happen if it's called multiple times? I am trying to write an alarm program where the signal handler function changes in runtime. It just doesn't work if I just call signal() once at the top of the program. And I also have 2 sigsetjmp() calls in the program. I really appreciate any help. Thanks.

Regards,
bashdrew

You can call signal() as many times as you want, and it does need to be reset usually. But these days signal() has been replaced with sigaction(), which gives you more options, including the ability to select whether you want the signal handler to work more than once or not.

Use of things like sigsetjmp and longjmp are not reccomended as they are counterintuitive and can have strange side-effects.

Thanks a lot.

Regards,
bashdrew