Signals

Signals are like software interrupts: they can be delivered to your program at any time due to a number of well-defined conditions, like when you write outside of your mapped memory pages, you will get sent a SIGBUS (bus error) or a SIGSEGV (segmentation violation) signal. If a subprocess of yours terminates, you will get a SIGCHLD (child stopped) signal. If your controlling terminal goes away, there is SIGHUP (terminal hung up), and if you use the alarm() function, you will get sent SIGALRM when the time expires. The system defines about 31 different signals, many of which deal with job control or specific hardware issues.

A signal is delivered to your program asynchronously whenever it enters the operating system, whether it be via ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.