This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/8] nptl: Add C11 threads thrd_* functions



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]