Boost logo

Boost :

Subject: Re: [boost] [Boost-users] [Review] Boost.Atomic review starts today, October 17th 2011
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2011-10-24 06:41:53


On 17/10/11 00:45, Tim Blechmann wrote:
> The review of Helge Bahmann's Boost.Atomic library starts today, October
> 17th 2011. It will end on October 26th.

Just a few quick comments about correctness.

* Operations build on top of compare_exchange (such as fetch_xor in
gcc-x86.hpp) use memory_order_relaxed for all operations. Are you sure
there are enough compiler memory barriers? Shouldn't you pass the
supplied memory order through to the CAS call?

* In gcc-ppc.h the BOOST_ATOMIC_ASM_SLOWPATH_CLEAR macro includes a 1:
label, yet many of the asm blocks that use it also include a 1: label.
Is this correct?

* In gcc-x86.h, the platform_cmpxchg64_strong implementation assumes
that T is an integral type, such that you can do (int)(desired>>32) to
take the top 32 bits, and (int)desired to take the low 32 bits, which is
essentially just the signed and unsigned variants of the 64-bit integer.
This should therefore not be a template, but a plain inline function.
cas64strong.hpp uses it incorrectly for pointers, but this
specialization is unnecessary anyway --- this file is only relevant for
32-bit x86.

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk