Accessing Shared Atomic Objects from within a Signal Handler in C
• Article
In this article, Robert Seacord describes how to safely access shared objects from a signal handler.
Publisher
Pearson Education, Informit
Topic or Tag
Abstract
Robert C. Seacord, author of Secure Coding in C and C++, Second Edition, describes how accessing shared objects in signal handlers can result in race conditions that can leave data in an inconsistent state. Historically, the only conforming way to access a shared object from a signal handler was to read from or write to variables of type volatile sig_atomic_t. With the advent of C11, atomics are now a better choice for accessing shared objects in signal handlers.