Boost logo

Boost :

From: Bill Wade (bill.wade_at_[hidden])
Date: 2000-08-31 11:14:55


> From: Kevlin Henney [mailto:kevlin_at_[hidden]]

> In message <8olq2n+n6bo_at_[hidden]>, William Kempf <sirwillard_at_my-
> deja.com> writes
> >So we may need two atomic types, one for
> >an integral type and one for a pointer type.
>
> Or three: sizeof(void *) need not be the same as sizeof(T *) for struct
> T. const_string uses char *, and hence would require the void * version.
>
> Or are we going to omit this possibility by assuming that we're not
> targeting platforms where sizeof(void *) != sizeof(T *)? This assumption
> would certainly be convenient and probably fairly realistic when on the
> issue of platform support for sufficiently familiar threading model.

I think you'll probably want to templatize your atomic pointer class anyway,
for type safety. On most platforms I'd implement all atomic data pointers
in terms of non-templated void*. If somebody has a platform where void*
operations are slow, he can specialize his own atomic_ptr<int*>.


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