February 11, 2005Re: CTRL-C trapping in Linux
Posted in reply to James Dunne
James Dunne wrote: > Stewart, > > A signal, in Linux (or any POSIX compliant OS) at least, is a special message > that the OS sends to a process on a special event. You can think of these > signals as sort-of like the Windows message pump idea, if you know how that > works. Basically, the Linux program sets up signal handling functions for the > different signals it wants to catch. > > For example, the most common signals to trap are SIGTERM and SIGINT. SIGTERM is > a signal sent when the OS needs to TERMinate the process (probably on system > shutdown, or via the kill shell command). The other signal, SIGINT, is the > signal sent when the user sends a CTRL-C to the process from the shell. It is > useful to trap this signal in order to shut down programs properly. <snip top of upside-down reply> I see. But doesn't that carry the same risk of being interrupted halfway through reading a 64-bit integer that Matthew mentioned? Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.