digitalmars.D - C1X memory-order in C1X
- bearophile (4/4) Aug 12 2011 I have found this though Reddit, I am not expert about this stuff, but i...
- Sean Kelly (25/28) Aug 12 2011 it's something for the design of the next C (C1X), about memory-order =
I have found this though Reddit, I am not expert about this stuff, but it's something for the design of the next C (C1X), about memory-order options: http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1525.htm Bye, bearophile
Aug 12 2011
On Aug 12, 2011, at 6:09 AM, bearophile wrote:I have found this though Reddit, I am not expert about this stuff, but =it's something for the design of the next C (C1X), about memory-order = options:=20 http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1525.htmThis is pretty much what's in C++0x. The pertinent bit is 5.1.2.4: "The library defines a number of atomic operations (7.17) and operations = on mutexes (7.25.4) that are specially identified as synchronization = operations. These operations play a special role in making assignments = in one thread visible to another. A synchronization operation on one or = more memory locations is either an acquire operation, a release = operation, both an acquire and release operation, or a consume = operation." A "consume operation" is effectively a raw operation from the = perspective of the CPU and compiler (unless you're targeting the Alpha). = The paragraph concludes with: "A synchronization operation without an associated memory location is a = fence and can be either an acquire fence, a release fence, or both an = acquire and release fence. In addition, there are relaxed atomic = operations, which are not synchronization operations, and atomic = read-modify-write operations, which have special characteristics." core.atomic provides the same basic options for atomicLoad and = atomicStore, though with safe defaults. I do think that anything but = fully sequenced or raw is getting more detailed than nearly every = programmer cares about, but I imagine the range of options will be = useful for the few library programmers out there who will be creating = lock-free data structures or whatever.=
Aug 12 2011