This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Fixing pthread_* namespace issues for thrd_* symbols
- From: Szabolcs Nagy <nsz at port70 dot net>
- To: Juan Manuel Torres Palma <j dot m dot torrespalma at gmail dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 1 May 2015 15:10:02 +0200
- Subject: Re: [RFC] Fixing pthread_* namespace issues for thrd_* symbols
- Authentication-results: sourceware.org; auth=none
- References: <CAD82F-pVYZvT+HHK4XchTeSEFeOUQoUBwtFA=-b52zs8i+_bJw at mail dot gmail dot com> <20150430162657 dot GD863 at port70 dot net> <CAD82F-raesW2rAFEaMO_CYtyaXVmEAfeQa2Fi3vOXLwc-TyTEg at mail dot gmail dot com>
* Juan Manuel Torres Palma <j.m.torrespalma@gmail.com> [2015-05-01 13:49:44 +0200]:
> > how do you plan to solve the namespace issue for the pthread types?
>
> Most pthread types (some of them will be required for C11 types) are
> architecture dependent, so my plan was to create a new header file
> (keeping all the architecture dependent defines and types here)
> including definitions of types like __pthread_t.
>
> Then the pthread.h will include it and do:
> typedef __pthread_mutex_t pthread__mutex_t;
>
that will break the c++ abi of pthreads
(we had the same problem back when c11 threads were implemented
in musl libc and ended up duplicating the typedefs i think..
you may want to look at the discussions on the musl list around
the alternatives
i think the type duplication within the implementation is ok,
but not pedantically correct on the abstract c language level:
wrappers redeclare the __pthread* functions with incompatible
types to be able to pass c11 type pointers
for future reference: all types in libc api should have type tag
in the implementation reserved namespace (ie __ prefixed) to
allow fixes like c11 threads later despite the hideous c++ abi)
> For other types like pthread_t that basically are unsigned long, will
> just copy the type:
> typedef unsigned long thrd_t;
>
> Cheers.
>
> --
> Juan Manuel Torres Palma.
> Computer Science Student at Universidad de Granada.