From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5592 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: C11 threads Date: Fri, 25 Jul 2014 12:40:57 +0200 Message-ID: <20140725104056.GO9928@port70.net> References: <1406282437.6438.34.camel@eris.loria.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 1406284877 1619 80.91.229.3 (25 Jul 2014 10:41:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Jul 2014 10:41:17 +0000 (UTC) Cc: musl@lists.openwall.com To: Jens Gustedt Original-X-From: musl-return-5597-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jul 25 12:41:10 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XAcw2-0001Vl-A8 for gllmg-musl@plane.gmane.org; Fri, 25 Jul 2014 12:41:10 +0200 Original-Received: (qmail 12023 invoked by uid 550); 25 Jul 2014 10:41:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 12012 invoked from network); 25 Jul 2014 10:41:09 -0000 Mail-Followup-To: Jens Gustedt , musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <1406282437.6438.34.camel@eris.loria.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:5592 Archived-At: * Jens Gustedt [2014-07-25 12:00:37 +0200]: > after I have seen that gcc since 4.9 has a working implementation of > atomics, I convinced myself to implement C11 threads within musl. > the conclusion about threads.h was that it should be abi compatible with glibc so we are waiting for them so i think you should coordinate with libc-alpha too > Choices : > > - all types are just the corresponding POSIX types > if glibc does the same then it's ok > Issues : > > - a lot of C11 are just weak symbols. to avoid polluting the link > space of a C11 application, I had to transform a lot of POSIX > function symbols into weak symbols, too. > i think this not ok: posix usually requires inequal function pointers for all public functions > - the include file threads.h includes pthread.h, so the namespace of > the C11 implementation is poluted with the pthreads stuff > i think this is not ok in the final version > - pthread_create and thrd_create are still too tightly linked > together. It would be good to split the corresponding file in two, > but this would make maintenance a bit more difficult. > > - there are still some symbols missing, for some of the functions > that I implemented as macro. work for a winter day > i assume you just have to add a ptototype before the macro definition and provide a trivial wrapper implementation > - I don't have much tests for all of this > > /* Don't create just additional symbols for the simple reason that the > return type of the POSIX and C11 functions are different. */ > > int __pthread_once(once_flag *, void (*)(void)); > // void call_once(once_flag *flag, void (*func)(void)); > #define _call_once(FL, FU) (void)__pthread_once((FL), (FU)) > #define call_once _call_once > the additional symbols are necessary and _[a-z] is not reserved for arbitrary usage for the implementation (only for file scope identifiers) > /* Best of all worlds, these are just weak aliases */ > int cnd_broadcast(cnd_t *); // pthread_cond_broadcast posix is not yet aligned with c11, but i think they will require inequal function pointers for these functions