Boost logo

Boost :

Subject: Re: [boost] Fw: [atomic] review results
From: Tim Blechmann (tim_at_[hidden])
Date: 2011-11-08 08:14:13


> > this implies that one can only use atomic integral types in shared
> > memory, but
> > not std::atomic<>, because the std::atomic<> template has a per-instance
> > is_lock_free member.
>
> 29.4/2: "The function atomic_is_lock_free (29.6) indicates whether the
> object is lock-free. In any given program execution, the result of the
> lock-free query shall be consistent for all pointers of the same type."
>
> The query is not per-instance. It can't be performed at compile time though
> (this is probably motivated by instruction set differences like the famous
> 386-486 divide where the program can only know at run time whether general
> atomics are available).

isn't atomic_is_lock_free only defined for integral types? and why isn't
atomic::is_lock_free a static member function?

dispatching per-object would actually make sense, because there may be
platforms which require objects to be aligned to certain memory boundaries for
double-width CAS.

cheers, tim


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