[jboss-dev] compareAndSet variation

David M. Lloyd david.lloyd at redhat.com
Wed Feb 10 10:40:59 EST 2010


This doesn't really make any sense - you're saying if the value is 
different, return the delta and leave the value unchanged, but if the delta 
was zero between the expect and update, then the value wouldn't need 
changing anyway!  You can do that with just a read.

- DML

On 02/10/2010 09:36 AM, Vladimir Blagojevic wrote:
> Hi,
>
> Not sure if there are any concurrency enthusiasts here but I'll give it a shot :)
>
> Would it be possible to make a lock-free, thread safe structure that would essentially retain "boolean compareAndSet(long  expect,long  update)" semantics but instead of returning boolean would return delta between actual underlying value and update value? Delta of zero would therefore mean that value has been set.
>
> Vladimir
>
>
>
>
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development



More information about the jboss-development mailing list