Summary: core.atomic: add compare-and-swap function with other
                    result type
           Product: D
           Version: D2
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos

--- Comment #0 from mimocrocodil <> 2012-10-16 15:08:40 PDT 
Many algorithms require to know what value it was under a pointer at the time
of comparison. (This value is unknown only when compare-and-swap fails, of
For example, it is required for RTCSS algorithm from which it can be obtained
CASN (compare-and-swap for any number of the elements).

Probably, CMPXCHG can do that.

Ideally it would be able to get value under pointer at the time of comparison
and the result of compare (true/false) as a struct. I do not know about
performance of that behaviour but in terms of more high-level programming it
will be useful. (CAS can be called often by its nature, and some of its result
will not be used usually, but I do not know, may be such cases will be
optimized by compiler.)

Or may be it can be three functions with different names.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to