Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The sig_atomic_t type is the integer type of an object that can be accessed as an atomic entity even in the presence of asynchronous interrupts. The type of sig_atomic_t is implementation-defined, though it provides some guarantees. Integer values ranging from SIG_ATOMIC_MIN through SIG_ATOMIC_MAX may be safely stored to a variable of the type. In addition, when sig_atomic_t is a signed integer type, SIG_ATOMIC_MIN must be no greater than -127 and SIG_ATOMIC_MAX no less than 127. Otherwise, SIG_ATOMIC_MIN must be 0 and SIG_ATOMIC_MAX must be no less than 255. The macros SIG_ATOMIC_MIN and SIG_ATOMIC_MAX are defined in the header <stdint.h>.

 

Noncompliant Code Example (Cast to volatile)

...

Note, however, that declaring an object volatile is not sufficient to prevent data races  when the object is simultaneously accessed from within two or more threads of execution. Additional memory visibility constraints may necessitate the use of platform-specific constructs such as memory barriers, for example, when each of the threads runs on a different processor. See  See CON02-C. Do not use volatile as a synchronization primitive for more information.

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

...

Bibliography

...

2003] Section 6.7.3, "Type

...

Qualifiers"
[ISO/IEC 9899:2011

...

]Section 6.7.3, "Type

...

Qualifiers," and section 7.14, "Signal

...

Handling <signal.h>

...

"

...

...