mailing list of musl libc
 help / color / mirror / code / Atom feed
* implement stdatomic.h library interface
@ 2015-07-23  9:58 Jens Gustedt
  2015-07-23 12:14 ` Joakim Sindholt
  2015-07-23 13:05 ` Szabolcs Nagy
  0 siblings, 2 replies; 14+ messages in thread
From: Jens Gustedt @ 2015-07-23  9:58 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2165 bytes --]

Hello,
about half a year ago well already discussed this, and at that time
Joakim had a proposal for an implementation.

Looking back on this, I think that we had a bit of a wrong focus,
then. The point for musl wouldn't necessarily be to provide the
<stdatomic.h> header itself, but the stub functions that are needed if
the compiler isn't able to inline all operations.

Since I needed it, now, I just went for it and implemented it. For the
moment this isn't integrated to musl but standalone, and for a proper
integration into musl I'd still have some work to do.

At the moment I see three principal possibilities for improvement with
atomics in musl:

(1) Provide the library interfaces that gcc >= 4.8 and clang > 3.6 (?)
    need. The interface is well documented, so let's just do it.

(2) Provide an interface to atomics for compilers that don't have it
    yet. This can be done more or less easily up to some limits for
    all compilers that implement the __sync builtins. gcc 4.8 is a bit
    special since it implements the atomic operations but not the type
    qualification.

    For compilers that don't have __sync or __atomic we could provide
    a minimal interface with lock-free _Atomic(int), _Atomic(void*)
    and atomic_flag, say.

    The limits for these platforms would be that code could only use
    the _Atomic(bla) specification for the types and macro calls to
    act upon them. But since for pre-C11 compilers this is just an
    extension, that would be a start.

(3) Review the internal use of atomics. AFAIR, Rich has already
    started to look into that, but in any case that part is probably
    independent of the first two points.

    In a later stage, once (1) and (2) are stable, we could then look
    into using _Atomic(int) and the corresponding macros.

Jens


-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::





[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-07-25 12:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-23  9:58 implement stdatomic.h library interface Jens Gustedt
2015-07-23 12:14 ` Joakim Sindholt
2015-07-23 22:21   ` Jens Gustedt
2015-07-24 23:18   ` Rich Felker
2015-07-25  6:33     ` Jens Gustedt
2015-07-25  9:17       ` Joakim Sindholt
2015-07-25 12:12         ` Jens Gustedt
2015-07-23 13:05 ` Szabolcs Nagy
2015-07-23 14:04   ` Jens Gustedt
2015-07-23 14:42     ` Szabolcs Nagy
2015-07-23 15:04       ` Jens Gustedt
2015-07-23 16:32         ` Joakim Sindholt
2015-07-23 17:02           ` Szabolcs Nagy
2015-07-23 22:44           ` Jens Gustedt

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).