$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [atomic] comments
From: Tim Blechmann (tim_at_[hidden])
Date: 2011-11-01 14:12:35
hi helge,
(responding to an old mail after re-reading my latest version of the draft)
> > > well if the atomics are truely atomic, then BOOST_ATOMIC_*_LOCK_FREE
> > > == 2 and I find a platform where you cannot use them safely between
> > > processes difficult to imagine (not that something like that could
> > > not exist)>
> > one would have to do the dispatching logic in the preprocessor, so one
> > cannot dispatch depending on the typedef operator.
>
> it's certainly possible to build a helper template to map types to these
> macro values (map to the value of BOOST_ATOMIC_INT_LOCK_FREE for all types
> T with sizeof(T) == sizeof(int) for example)
the preprocessor variables are only defined for integral types.
the standard also says:
template <class T>
bool atomic_is_lock_free(const volatile atomic_type*);
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.
but atomic_is_lock_free is only defined for integral atomic types.
so to be standard compliant, one could build the helper template only for
integral atomic types.
cheers, tim