liveBook · Manning

Signal handler

A signal handler is a function or mechanism that specifies or performs a response when a signal or notification is delivered.

How 4 Manning books explain it

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 control flow caused by synchronous faults or asynchronous events.
How deep it goes
Explains interrupt timing and portable handling, then gives handler-safety constraints and a conditional atomic counting implementation.
Examples
Uses arithmetic faults, termination requests, registration output, and per-signal atomic counts as examples.
What you can do after
Evaluate signal-handler safety by limiting handler work and choosing permitted types for communication.

Read how Modern C, Third Edition explains signal handler →

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 exceptional conditions triggered by synchronous or asynchronous interrupts.
How deep it goes
Explains interrupt types and registration through a handler example, including error checks and conditional lock-free counting.
Examples
Uses a handler that counts signals, selects exit behavior, or records an interrupt after restoring default handling.
What you can do after
Evaluate handler designs by keeping work minimal and using suitable types to communicate with interrupted code.

Read how Modern C explains signal handler →

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.

Read how Django in Action explains signal handler →

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 application shutdown rather than relying solely on default termination.
How deep it goes
Explains handler constraints and walks through registration, a global shutdown flag, and signal dispositions.
Examples
Demonstrates a Rust loop responding to SIGTERM and a separate program switching between SIG_IGN and SIG_DFL.
What you can do after
Apply it via libc to register a handler and configure signal dispositions.

Read how Rust in Action: Systems programming concepts and techniques explains signal handler →

Also covered in

What to know first

Related concepts

Questions about signal handler

What is signal handler?

A signal handler is a function or mechanism that specifies or performs a response when a signal or notification is delivered.

Which Manning books explain signal handler?

Modern C, Third Edition, Modern C, Django in Action and Rust in Action: Systems programming concepts and techniques.

What should I know before learning signal handler?

Manning books that teach signal handler usually introduce atomic_flag, atomic type, exception and lock-free first.

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.