Does the C++11 standard formally define acquire, release, and consume operations?

流过昼夜 提交于 2019-12-04 22:29:01

There's an informal summarized definition given in one of the notes:

performing a release operation on A forces prior side effects on other memory locations to become visible to other threads that later perform a consume or an acquire operation on A.

Besides that, the behavior of acquire and release operations is fully defined in 1.10, specifically in how they contribute to happens-before relationships. Any definition apart from behavior is useless.

I don't see any formal definition of acquire/release semantics after a quick look through the standard, so my guess is that they are assumed to be commonly understood terms.

They can't define everything, after all.

It's not a definitive reference, but Raymond Chen has blogged about acquire/release semantics. His post includes a link to Microsoft's definition of acquire and release semantics, which you might also find useful.

actually these operations are defined in section 1.10/5-12.

release/acquire pair corresponds to the happen before relationship; while release/consume pair to the dependency-ordered before relationship.

I also take acquire/release semantics to be fairly definitive on it's own; although they're more hardware specific terms historically rather than programming terms.

But, I think section 1.10 para 5 and 6 seem to match all acquire/release semantics definitions I've read in other language standards as well as CPU definitions.

Regardless, one of the major points of C++11 was to define a modern memory model to support concurrent and multi-threaded code. I find it hard to believe they didn't get it right :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!