Boost logo

Boost :

Subject: Re: [boost] [atomic] [release] possible linking problem with atomic
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-01-11 11:47:11


On Friday 11 January 2013 17:35:54 Domagoj Saric wrote:
> On 10.1.2013. 20:02, Andrey Semashev wrote:
> > Well, it's not a header-only library.
>
> That's a bit 'sad' given that 'most' platforms/compilers support builtin
> atomic operations/instructions...
> Is there anyway (e.g. define a configuration macro) to make the library work
> as header-only on those platforms (e.g. x86 and ARM)?

No, currently there isn't one.

Note that the pool of spinlocks can be used even on platforms with hardware
support for atomics (e.g. when the atomic<T> is used for a too large T).

> Can the library be changed in the future so that it includes "spin-lock
> pools&co" and thus requires linking only when building for unsupported
> platforms/platforms without atomic operations?

That would be a useful improvement and there were discussions of this matter
recently (in the context of porting Boost.SmatrPtr to Boost.Atomic). In
particular, I proposed to provide a header-only interface for types that can
be made atomic on the target platform and a separately included spinlock-based
fallback that would require linking.


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