[jboss-dev] compareAndSet variation

Brian Stansberry brian.stansberry at redhat.com
Wed Feb 10 10:49:44 EST 2010


You're mixing the use of the 'expect' param vs ths 'update' param. The 
delta he's talking about would be on the 'expect' vs current value.

On 02/10/2010 09:40 AM, David M. Lloyd wrote:
> 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
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development


-- 
Brian Stansberry
Lead, AS Clustering
JBoss by Red Hat



More information about the jboss-development mailing list