This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/8] nptl: Add C11 threads thrd_* functions
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 15 Nov 2017 09:22:42 -0200
- Subject: Re: [PATCH 1/8] nptl: Add C11 threads thrd_* functions
- Authentication-results: sourceware.org; auth=none
- References: <1506112024-22601-1-git-send-email-adhemerval.zanella@linaro.org> <1506112024-22601-2-git-send-email-adhemerval.zanella@linaro.org> <8f17b389-ffda-4add-f8f8-8acd7be96c60@redhat.com>
On 15/11/2017 06:09, Florian Weimer wrote:
> On 09/22/2017 10:26 PM, Adhemerval Zanella wrote:
>> This patch adds the thrd_* definitions from C11 threads (ISO/IEC
>> 9899:2011),
>> more specifically thrd_create, thrd_curent, rhd_detach, thrd_equal,
>> thrd_exit, thrd_join, thrd_sleep, thrd_yield, and required types.
>>
>> Mostly of the definitions are composed based on POSIX conterparts,
>> such as
>> thrd_t (using pthread_t).
>
> I have skimmed the C11 discussion of these types, and C11 says that
> mtx_t et al. are “identifiers”. To me, this suggests they are
> handles, just like pthread_t in the POSIX threads implementation.
My understanding is "identifiers" follow the definition from C11 6.2.1
which does
not exclude a tag/struct to represent it. A possible issue is POSIX has
a model
o flat address space that is shared between all thread while C standard
makes it
implementation defined (allowing for instance segmented address space or
different vmas for hybrid computing). However I think C11 standard makes
no amend to address it and although there is some suggestions [1] to add
feature tests to handle it, it was no incorporated.
[1]
https://gustedt.wordpress.com/2012/10/14/c11-defects-c-threads-are-not-realizable-with-posix-threads/
>
> I'm sorry, but this would make the current implementation based on
> pthread types (without indirection) invalid. 8-(
That is not my understanding. Could you point in C11 standard where
identifier
in thread.h definition exclude the use of tag types?
>
> Thanks,
> Florian