[PATCH][BZ #11087] Use atomic operations to track memory
Joseph S. Myers
joseph@codesourcery.com
Thu Oct 17 12:41:00 GMT 2013
On Thu, 17 Oct 2013, Ondrej Bilka wrote:
> - if (++mp_.n_mmaps > mp_.max_n_mmaps)
> + __sync_fetch_and_add (&mp_.n_mmaps, 1);
> + if (mp_.n_mmaps > mp_.max_n_mmaps)
The __sync_* built-in functions are deprecated in favour of the __atomic_*
functions (with finer-grained memory model / barrier control) in more
recent GCC. You should be using glibc's own macros such as
atomic_increment and let the architectures determine whether those expand
to __sync_*, __atomic_* or inline asm.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list