[LCP]Signal handler question

Bill Rausch bill at numerical.com
Thu Oct 4 03:05:37 UTC 2001


At 12:40 PM -0400 10/3/01, David Filion wrote:
>I'm working a program that needs to do a "clean" shutdown when it catches
>certain signals.  (One of the items is to disconnect cleanly from a 
>DB.)   Now,
>because I'm limited in the commands/calls I can use in a signal handler I was
>thinking of using a siglongjmp to return to main() then call my cleanup
>function/exit routine.    Does anyone know if I'll still be limited to the
>"safe" list of signal commands after I jump or will I be able to use the full
>set again in my cleanup function?

My practice in a the signal handler is to just set some global flag 
and then return. The main program can periodically check for this 
flag and when it sees it has been set takes appropriate action, which 
can include any program logic I desire.


-- 
  Bill Rausch, Software Development, Unix, Mac, Windows
  Numerical Applications, Inc.  509-943-0861   bill at numerical.com



More information about the linuxCprogramming mailing list