Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
C28112
Collapse the table of content
Expand the table of content

C28112

warning C28112: A variable which is accessed via an Interlocked function must always be accessed via an Interlocked function

See line number: It is not always safe to access a variable which is accessed via the Interlocked* family of functions in any other way.

A variable that is accessed by using the Interlocked executive support routines, such as InterlockedCompareExchangeAcquire, is later accessed by using a different method.Although certain ordinary assignments, accesses, and comparisons to variables that are used by the Interlocked* routines can be safely accessed by using a different method, the risk is great enough to justify examining each instance.

The following code example generates this warning:

inter_var --;
...
InterlockedIncrement(&inter_var);

The following code example avoids this warning:

InterlockedDecrement(&inter_var);
...
InterlockedIncrement(&inter_var);
Show:
© 2015 Microsoft