liveBook · Manning

Signal.h

As explained in Modern C, Third Edition

signal.h is the standard C header that declares the signal-handling functions, types, and constants.

Ignore a signal

#include <signal.h> int main(void) { signal(SIGABRT, SIG_IGN); raise(SIGABRT); } SIG_IGN selects the ignore disposition for SIGABRT; raise triggers that signal. section 19.6

<signal.h> defines C’s minimal signal-handling interface. Each signal number has a disposition: SIG_DFL selects its default handling, SIG_IGN ignores it, and a programmer can supply a handler. A handler receives the signal number. If it returns, control resumes where it was interrupted. section 19.6

Figure 19.3 Control flow after an interrupt return jumps to the position where the interrupt occurred
figure

The diagram shows normal control flow interrupted by a handler and resuming at the interruption point. section 19.6

TAKEAWAY: Use this interface for elementary situations. Platforms provide additional signal numbers and rules; relying on them requires platform-specific definitions and reduces portability. section 19.6

How Modern C, Third Edition covers it

How deep it goes
Explains signal numbers, dispositions, handler arguments, and interrupted control flow, while leaving platform extensions to their providers.
Examples
Uses a handler that switches on its signal argument and listings of signal and raise declarations.
What you can do after
Evaluate/understand when standard C signal handling suffices and when platform-specific definitions affect portability.
How it connects
Connects signal handlers to control flow, hardware interrupts, and portability.

Also explained in

Compare how 2 books explain signal.h →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C, Third Edition. The section links point to the parts of the book it draws on.