|
Boost : |
From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-04-11 11:01:31
Peter Dimov wrote:
> Joaquín Mª López Muñoz wrote:
>
>> I think that the functions
>>
>> atomic_increment
>> atomic_decrement
>> atomic_conditional_increment
>>
>> should be marked as inline, as they are defined in a header file. This
>> is causing multiple definition problems, see for instance
>>
>> http://tinyurl.com/6eub2
>
> Yes, you are right. I'd fix it but I don't know whether "inline" needs
> to go before or after "asm". ;-) Rene?
Sorry.. it took a while, waiting for the CVS update. And the answer is
"neither". Function level assembly can't be inlined. At least that's
what the compilers says :-)
Which means changing to use statement level assembly. So it would have
to be something like this...
inline void atomic_increment( register long * pw )
{
asm
{
loop:
lwarx r4, 0, r3
addi r4, r4, 1
stwcx. r4, 0, r3
bne- loop
}
}
Which when applied to the other functions, compiles without warnings.
And since all the tests pass, I checked in the changes to CVS.
-- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk