Subject: Re: [boost] [atomic] comments
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2011-11-01 14:54:19


On Tuesday, November 01, 2011 19:29:50 Helge Bahmann wrote:
> On Tuesday 01 November 2011 19:08:20 Andrey Semashev wrote:
> > Lock-based IPC can be much more efficient than socket-based.
>
> Well then create a shared memory region and use explicit locking. This is
> even more efficient than the many implicit locks in miniscule atomic
> objects.
>
> See, by *not* exporting the spinlock of the fallback path of atomic<>
> objects I just made your IPC even more efficient.

That's arguable but I caught your drift. Let's say
boost::interprocess::atomic<> will make me happy.

> > GCC has the luxury of a shared runtime which can provide process-wide
> > table of spinlocks. Boost.Atomic is header-only, so in multi-module
> > applications this table has to be exported so that all modules use the
> > single table. I mentioned that in the review. Do you have ideas of how
> > to achieve that? Most obvious would be to link to Boost.Atomic
> > dynamically...
>
> the same way shared_ptr treats its spinlock pool (template specialization,
> and I guess this leads to a symbol with virtual linkage, the instances all
> of which are collapsed into a single instance by the run-time linker)

It doesn't work on Windows. shared_ptr is fine there because it actually uses
real atomic ops on that platform. IIUC, Boost.Atomic cannot be saved by that.