Is this atomic code correct?
Sean Kelly
sean at invisibleduck.org
Thu Mar 19 08:02:44 PDT 2009
BCS wrote:
> Hello Sean,
>
>> min() doesn't perform atomic operations (in fact, it probably just
>> takes the parameters by value) so it isn't guaranteed to refetch the
>> values.
>>
>
> Hmmm. I wonder how that mixes with it being a delegate. I guess inlining
> and whatnot would make a difference. Ug.
Yeah. It would probably actually work with the current DMD, but if a
compiler inlined the call to min it could cache the result in a register
and reuse it.
More information about the Digitalmars-d-learn
mailing list