Signal handler
A signal handler is a function or mechanism that specifies or performs a response when a signal or notification is delivered.
Modern C, Third Edition
A signal handler is a function invoked in response to a signal raised by an execution environment or program.
- How it is used
- Handles exceptional conditions triggered by synchronous faults or asynchronous external events.
- How deep it goes
- Explains event timing and handler safety, then shows registration and counting interfaces without developing a general recovery procedure.
- Examples
- Uses fault and termination scenarios, signal-registration listings, and a per-signal counter guarded by `ATOMIC_LONG_LOCK_FREE`.
- What you can do after
- Operate/configure it by registering a handler that records a condition and leaves further work to interrupted code.
Modern C
A signal handler is a function invoked by the C signal-handling mechanism when a specified signal is delivered.
- How it is used
- Handles externally triggered exceptional conditions through C's signal mechanism.
- How deep it goes
- Explains synchronous and asynchronous delivery, handler registration, signal-specific responses, and shared-state limits without specifying a general recovery procedure.
- Examples
- Walks through a handler that counts deliveries, exits for SIGTERM or SIGABRT, and records other signals in an interrupt flag.
- What you can do after
- Apply it via signal() to install a handler that records an interrupt condition for later handling.
Django in Action
A signal handler is a callable that receives a signal notification and performs corresponding application logic.
- How it is used
- Automates creation of a related UserProfile when Django saves a newly created User.
- How deep it goes
- Explains observer registration, pre/post timing, receiver arguments, fixture handling, duplicate checks, and ORM creation.
- Examples
- Demonstrates a User post-save receiver that creates a missing UserProfile and verifies the resulting relation.
- What you can do after
- Build it from scratch by registering a post_save receiver that safely creates related profiles.
Rust in Action: Systems programming concepts and techniques
A signal handler is a function or disposition associated with a signal that determines how a process responds when the signal is delivered.
- How it is used
- Uses signal handlers to initiate clean shutdown instead of relying on a signal’s default termination behavior.
- How deep it goes
- Works through registration, handler constraints, and a main-loop flag pattern without developing a general signal-handling reference.
- Examples
- Tests SIGTERM and SIGUSR1 in a looping program and demonstrates ignoring SIGTERM before restoring its default behavior.
- What you can do after
- Apply it via Rust’s libc::signal() to register a minimal handler and let the main loop initiate shutdown.
Read how Rust in Action: Systems programming concepts and techniques explains signal handler →
Related concepts
- signaluses · An operating-system signal is an asynchronous notification delivered to a process to report an event or request handling.
- sig_atomic_tuses · sig_atomic_t is an integer type whose object evaluations and assignments are guaranteed to be indivisible with respect to signal handling.
- post_saveuses · post_save is a Django ORM signal emitted after a model instance has been saved.
- booleanuses · A Boolean is a logical type or value representing truth or falsity, conventionally with two states: true and false.
- signal.huses · signal.h is the standard C header that declares signal-handling functions, types, and constants.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



