This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: installing the <atomic.h> header?
- From: Petr Baudis <pasky at suse dot cz>
- To: Chris Metcalf <cmetcalf at tilera dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 5 Nov 2010 01:11:59 +0100
- Subject: Re: installing the <atomic.h> header?
- References: <4CD308BB.9080809@tilera.com>
Hi!
On Thu, Nov 04, 2010 at 03:25:47PM -0400, Chris Metcalf wrote:
> Glibc uses <atomic.h> (with <bits/atomic.h>) internally but does not
> install it. The header would seem to be a great way to provide convenience
> wrappers to atomic functionality. On our platforms (TILEPro, TILE-Gx) the
> atomic operations are a mix of builtins, compare-exchange loops, and fast
> kernel calls that no user would want to have to re-invent just to get
> access to proper atomic instructions. There used to be folks who used
> <asm/atomic.h> from userspace for this kind of thing, but of course that no
> longer works, as the kernel no longer exports that header.
IMHO most of this stuff is not really a kernel service or worth a
library routine, but just making use of your instruction set properly.
So a compiler matter, solved not too badly with
http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Atomic-Builtins.html
I don't think the extra layer of <atomic.h> convenience routines is
all that significant; and no kernel calls are wrapped by this, AFAICS.
--
Petr "Pasky" Baudis
The true meaning of life is to plant a tree under whose shade
you will never sit.