From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9092 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: atomic.h cleanup Date: Mon, 11 Jan 2016 20:03:56 +0100 Message-ID: <20160111190356.GA13558@port70.net> References: <20160110122139.GF2016@debian> <20160110165718.GR238@brightrain.aerifal.cx> <20160110173509.GG2016@debian> <20160111163544.GI2016@debian> <1452532349.28095.10.camel@inria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1452539056 31031 80.91.229.3 (11 Jan 2016 19:04:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Jan 2016 19:04:16 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9105-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 11 20:04:11 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aIhlC-0004gu-MN for gllmg-musl@m.gmane.org; Mon, 11 Jan 2016 20:04:10 +0100 Original-Received: (qmail 11308 invoked by uid 550); 11 Jan 2016 19:04:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 11290 invoked from network); 11 Jan 2016 19:04:08 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <1452532349.28095.10.camel@inria.fr> User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:9092 Archived-At: * Jens Gustedt [2016-01-11 18:12:29 +0100]: > Am Montag, den 11.01.2016, 17:35 +0100 schrieb Markus Wichmann: > > OTOH, maybe we simply shouldn't write synchronisation primitives > > ourselves and instead use the ones provided by GCC (and let other > > compilers suck on a salty sausage, if they don't support those > > primitives). > > I think on the long run we should use C11 atomics and leave the dirty > work to the compiler writers. To my experience they do good work with > that now, the assembler they produce looks nice. > yes but old compilers had various bugs on various targets. > My stdatomic library is sitting there, ready to integrate into > musl. It solves the problem of backwards compatibility for all > compilers that that implement the __sync builtins. (gcc and clang with > very old version numbers.) > i think simpler compilers like pcc, cparser, tcc dont implement that. if musl moves to compiler builtins then i'd like to have a possibility to compile atomic primitives as a separate tu > Last time I looked, all usages but one of atomic operations in musl > are clean. If an atomic operation is used for a data a some point, > atomic operations are used in all other places. So moving to > _Atomic(int) would be a option. (Basically this would be `volatile > int*` => `_Atomic(int)`, IIRC). > pthread_once_t and pthread_spinlock_t are publicly visibles type (without volatile and _Atomic) i dont think we can fix those without abi change.