I saw in HP aCC STD implementation that thay are uses ACQ in increase and decrease. If you think REL is better it can be change. Thanks -----Original Message----- From: Peter Dimov [mailto:pdimov@mmltd.net] Sent: Thursday, July 26, 2007 2:29 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Support for sp_counted_base for HPItaniumaCCcompiler Baruch Zilber wrote:
You are right. I fixed it and here is the new implementation:
inline void atomic_increment( int * pw ) { _Asm_fetchadd(_FASZ_W, _SEM_ACQ, (void*)pw, +1, _LDHINT_NONE); }
inline int atomic_decrement( int * pw ) { int r = static_cast<int>(_Asm_fetchadd(_FASZ_W, _SEM_ACQ, (void*)pw, -1, _LDHINT_NONE)); if (1 == r) { _Asm_mf(); }
return r - 1; }
Hmm. Why did you switch to _SEM_ACQ? atomic_increment should use _REL because it's rumored to be cheaper, and atomic_decrement needs to use _REL for correctness. This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement, you may review at http://www.amdocs.com/email_disclaimer.asp