This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #11087] Use atomic operations to track memory
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 17 Oct 2013 12:41:04 +0000
- Subject: Re: [PATCH][BZ #11087] Use atomic operations to track memory
- Authentication-results: sourceware.org; auth=none
- References: <20131017114140 dot GA24230 at domone dot podge>
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