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 v8 2/8] nptl: Add C11 threads mtx_* functions



On 06/07/2018 09:51, Florian Weimer wrote:
> On 02/02/2018 06:04 PM, Adhemerval Zanella wrote:
>> This patch adds the mtx_* definitions from C11 threads (ISO/IEC 9899:2011),
>> more specifically mtx_init, mtx_destroy, mtx_lock, mtx_timedlock, mtx_trylock,
>> mtx_unlock, and required types.
>>
>> Mostly of the definitions are composed based on POSIX conterparts, and mtx_t
>> is also based on internal pthread fields, but with a distinct internal layout
>> to avoid possible issues with code interchange (such as trying to pass POSIX
>> structure on C11 functions and to avoid inclusion of pthread.h).  The idea
>> is to make possible to share POSIX internal implementations for mostly of
>> the code (and making adjustment only when required).
> 
> Should we check for the supported mutex types and error out if the type does not match?  The interface does not support the full range of error codes required by robust mutexes, for example—EOWNERDEAD is missing.
> 

I am not sure if adding extra tests will yield any gain, specially on mutex
operations which users would expect optimized fast paths.  I really think
we should handle as undefined behaviour if uses try to use pthread_t objects
with c11 threads function (in similar manner it is undefined behaviour if
uses messes with internal pthread_mutex_t objects data directly).


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