Follow-up Comment #1, bug #99130 (project xrootd):
More Generally,
There are two versions of these atomics.
One with builtin atomic CPU instructions and another one emulated.
These two implementations differ in two ways:
- they are not semantically equivalent:
for instance AtomicCAS(x, y, z)
o in the first implementation, it's a function and it has a return value
which is usefull (see later)
o in the second implmentation, it's a macro with an "if" and doesn't have a
return value
So, some code might compile with HAVE_ATOMICS=1 and not compile with
HAVE_ATOMICS not being defined. (it happened to me)
- they are not functionnaly equivalent:
o in the first case, the function compares x with y and if they are equal,
it updates the value of x with the value of z.
It returns true if x was update, false else.
o in the second case. It doesnt'return anything.
So the user of this function, if he is aware of that, he can try to deal with
that like this:
+ do something like
AtomicBeg(Mtx);
AtomicCAS(x, y, z);
returnvalue=(x==y);
AtomicEnd(Mtx);
_______________________________________________________
Reply to this item at:
<http://savannah.cern.ch/bugs/?99130>
_______________________________________________
Message sent via/by LCG Savannah
http://savannah.cern.ch/
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1
|