This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Remove volatile qualifiers from mt_allocator
Richard Guenther wrote:
Less radical than two counters, we could access the atomic counter always
atomically at allocation time; atomically at deallocation time when
__block->_M_thread_id != __thread_id; normally at deallocation time when
__block->_M_thread_id == __thread_id. I think this is also fine and a tad
better...
Indeed. As we allocate from our local pool only this is fine.
FYI, now I know a much better way to fix this, meaning: 1- No atomic
operations at allocation time, minimal performance impact; 2- Safe wrt
old binaries linking to the current version of the exported functions of
mt_allocator (I'm not changing anything in mt_allocator.h, nothing in
the exported interfaces of mt_allocator.cc, etc...). I should have
something well tested in a day or two max :)
Paolo.