On Mon, Dec 26, 2005 at 06:38:36PM -0700, Maximilian Wilson wrote:
> Pseudocode:
> CompareAndSwap( Cell OldValue NewValue )
> ATOMIC:
> if @Cell == OldValue
> Cell := NewValue
> return OldValue
> else
> return @Cell
How about this?
fun {CAS Cell Old New}
New_ Old_ in
{Exchange Cell Old_ New_}
if Old_ == Old then
New_ = New
else
New_ = Old_
end
Old_
end
_________________________________________________________________________________
mozart-hackers mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-hackers