Boost logo

Boost :

Subject: Re: [boost] [lock-free] CDS -yet another lock-free library
From: Daniel Trebbien (dtrebbien_at_[hidden])
Date: 2010-03-28 18:02:02


>> I'd like to present to boost community the CDS (Concurrent Data
>> Structure) C++ library at libcds.sourceforge.net. It is an
>> attempt to generalize well-known lock-free (and a few lock-based)
>> data structures discovered by famous researches (M.Michael,
>> N.Shavit and others). The library is mostly header-based, only
>> the kernel of light-weight memory managers is resided in small
>> dynamic library.
>> The CDS library supports a set of modern processor architectures:
>> x86, amd64, ia64, sparc; compiler supported is GCC 4 and MS Visual
>> C++ 2008. The last CDS release 0.6.0 is developed close to C++
>> Memory Model proposal.
>> I need the recommendations from boost community about :
>> 1. Are the atomic primitives implemented correct for each of supported
>> processor?.. I'm not an expert in this area...
>
> Have you considered using the proposed Boost.Atomic? This should
> support more platforms.
>
> If there is something missing from Boost.Atomic that is needed for this
> purpose, it would be useful to know about it.

Hi Phil,

I searched the sandbox to see if there was a folder for Boost.Atomic, just to make sure that I didn't miss it. Are you referring to the contents of <boost/interprocess/detail/atomic.hpp>?

A while ago I was working on a project that required some new atomic primitives which were missing from that file, and I think that they would be nice additions to an atomic operations library:

1. `atomic_dec_if_nz` - Atomically decrements an integer if it is not zero
2. `atomic_inc_if_nmax` - Atomically increments an integer if it is not the maximum possible value for its type
3. `atomic_inc_if_nz_nmax` - Atomically increments an integer if it is neither zero or the maximum possible value for its type

I have attached a file that contains my (g++, x86) implementations of these functions for `uint8_t` and a basic unit test. Do you think that these would be good to include in Boost.Atomic? If so I can work on x86 versions for more standard int types as well as different compilers.

Daniel



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