|
|
Subscribe / Log in / New account

Protecting control dependencies with volatile_if()

Protecting control dependencies with volatile_if()

Posted Jun 19, 2021 18:47 UTC (Sat) by kkdwivedi (subscriber, #130744)
In reply to: Protecting control dependencies with volatile_if() by Paf
Parent article: Protecting control dependencies with volatile_if()

There is a recent paper (P2327) addressing compound operations (those used to flip bits in particular).

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p...


to post comments

Protecting control dependencies with volatile_if()

Posted Jun 20, 2021 0:47 UTC (Sun) by Paf (subscriber, #91811) [Link] (1 responses)

Ah, thanks - I realize now I misread the original post as objecting to them. The decision of the standard to deprecate them seems ……. Let’s say “user hostile”.

Protecting control dependencies with volatile_if()

Posted Jun 21, 2021 3:33 UTC (Mon) by foom (subscriber, #14868) [Link]

The problem is that users expect volatile variables to be safe against interrupts/signals. And that is generally the case for read and write operations. So, by analogy, users expect `x |= 5;` on a volatile int to be the way to spell a read-modify-write which is also safe against interrupts. But, it has never guaranteed that -- neither in the spec nor in most implementations.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds