Liste des Groupes | Revenir à c arch |
On 11/16/24 16:21, Chris M. Thomasson wrote:Strange! C++ has:
Fwiw, in C++ std::memory_order_consume is useful for traversing a node based stack of something in RCU. In most systems it only acts like a compiler barrier. On the Alpha, it must emit a membar instruction. Iirc, mb for alpha? Cannot remember that one right now.That got deprecated. Too hard for compilers to deal with. It's now
same as memory_order_acquire.
Which brings up an interesting point. Even if the hardware memoryIndeed. The compiler needs to know about these things. Iirc, there was an old post over c.p.t that deals with a compiler (think it was GCC) that messed up a pthread try lock for a mutex. It's a very old post. But I remember it for sure.
memory model is strongly ordered, compilers can reorder stuff,
so you still have to program as if a weak memory model was in
effect. Or maybe disable reordering or optimization altogether
for those target architectures.
Les messages affichés proviennent d'usenet.