Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 21 Nov 2013 15:44:28 +0100
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: Feature request: stdatomic.h and threads.h

Hi,

Am Donnerstag, den 21.11.2013, 15:16 +0100 schrieb Szabolcs Nagy:
> * Daniel Cegie?ka <daniel.cegielka@...il.com> [2013-11-21 11:31:35 +0100]:
> > Is there a plan to add support for stdatomic.h and threads.h?
> 
> how would that work?
> there is still no c11 atomic support in gcc
> (there is an experimental c11 atomic branch with a gcc
> provided stdatomic.h which uses some gcc extensions,
> but there are still compiler issues eg there is no
> solution for _Atomic float yet because x+=0.1 requires
> fenv manipulation without libc support and that means
> new asm for all archs,

As far as I understood this will be merged in the next gcc version

> meanwhile wg14 and wg21 are still busy filling the holes in the
> specs..)

I haven't seen much about atomics discussed there.

For all that is integer type atomics at least the support in gcc is
sufficient to implement everything that is function call based (so not
the operations like += etc).

In P99 I have a shallow wrapper on top of the __sync_ builtins that
implements all type generic macros in atomic.h. It works fine for
everyday's use and efficiently produces optimal assembler, AFAIKS.

Restriction besides the operations mentioned above are

 -  variable declaration. Out of the two forms

    _Atomic int toto;
    _Atomic(int) toto;

    I only support the later (as a macro) if the compiler doesn't
    implement the first.

 - the different modes of memory consistency are not supported and
   always resolve to the strongest possible consistency

So yes a good deal of the *library* support is possible directly, even
with oldish versions of gcc, and can be implemented conforming to the
specs.

Also, I discovered recently that icc now has full support for
atomic.h, so definitively this is something that will see increased
use in a relatively near future.

Jens


-- 
:: INRIA Nancy Grand Est :: http://www.loria.fr/~gustedt/   ::
:: AlGorille ::::::::::::::: office Nancy : +33 383593090   ::
:: ICube :::::::::::::: office Strasbourg : +33 368854536   ::
:: ::::::::::::::::::::::::::: gsm France : +33 651400183   ::
:: :::::::::::::::::::: gsm international : +49 15737185122 ::



Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.