Sig_atomic_t
sig_atomic_t is an integer type whose object evaluations and assignments are guaranteed to be indivisible with respect to signal handling.
Modern C, Third Edition
sig_atomic_t is an integer type whose object evaluation and assignment operations are guaranteed to be indivisible with respect to signal handling.
- How it is used
- Uses a signal-handler flag to record an interrupt condition for handling after the handler returns.
- How deep it goes
- Defines uninterruptible loads and stores, then explains why increment is unsafe; does not develop sig_atomic_t beyond its restricted guarantees.
- Examples
- Contrasts storing a signal number in a flag with incrementing a counter, and shows a lock-free atomic counter alternative.
- What you can do after
- Build a minimal signal handler from scratch that records a signal number in a volatile sig_atomic_t flag.
Modern C
sig_atomic_t is an integer C type whose object evaluations and assignments are guaranteed to be uninterruptible with respect to signal handling.
- How it is used
- Stores a signal number for a signal handler without an interruptible assignment.
- How deep it goes
- Defines uninterruptibility and limits the guarantee to loads and stores, not increments.
- Examples
- Uses a handler that stores its received signal number and contrasts it with signal counting.
- What you can do after
- Evaluate/understand when sig_atomic_t supports a handler’s load or store and why it should not serve as a counter.
Related concepts
- signal handlerused by · A signal handler is a function or mechanism that specifies or performs a response when a signal or notification is delivered.
- atomic typealternative to · An atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
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.

