...
A better approach is to embed a concurrently-accessed variable inside a union, along with a long
variable, or at least some padding to ensure that the concurrent variable is the only element to be accessed at that address. This would effectively guarantee that no other variables are accessed or modified when the concurrent variable is accessed or modified.
...
Noncompliant Code Example (Bit Field)
In the following non-compliant noncompliant code, two executing threads simultaneously access two separate members of a global struct
.
...