[ruby-core:63027] Re: [CommonRuby - Feature #8259] Atomic attributes accessors

From: Eric Wong <normalperson@...>
Date: 2014-06-09 18:17:07 UTC
List: ruby-core #63027
Joel VanderWerf <joelvanderwerf@gmail.com> wrote:
> On 06/09/2014 04:06 AM, Eric Wong wrote:
> >I'm not sure if setting the attribute on the ivar is a good way to go.
> >Entries in structs, arrays, hashes, etc may also benefit from atomic
> >operations (or at least I would like that).
> >
> >Maybe something like:
> >
> >	old = hash["foo"] x= new	# swap
> >	hash["foo"] ?x= old : new	# cas
> >
> 
> Do you mean that `x` stands for a symbol to be chosen later?

No, `x` being short for xchg.  And `?x=` being cmpxchg
(and trying to look like a ternary operation)

In This Thread