This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 0/6] Add support for ISO C11 threads.h
On Tue, 2017-03-21 at 17:09 -0300, Adhemerval Zanella wrote:
> 405: The mutex specification
>
> "The C11 specification of mutexes is missing the total order over all the
> calls on a particular mutex."
>
> My understanding is current implementation with POSIX primitives should be
> enough to guarantee C11 total order over mutex (which is currently based on
> acquire/release semanthics).
Yes.
> 414: Typos in 6.27 Threads <threads.h>
>
> The typos does clarify one definition of mtx_plain and raises a questioning:
> how should we proceed if mtx_timedlock is used along with a mtx_plain mutex?
If C11 requires that mtx_timedlock is supplied a mutex that supports
timeout. If the program violates this requirement, it is undefined
behavior, and glibc is allowed to just acquire with a timeout.
> 469: lock ownership vs. thread termination
See my other response to this thread.
>
> 470: mtx_trylock should be allowed to fail spuriously
>
> It align with POSIX and thus with __pthread_mutex_trylock which uses a
> atomic_compare_and_exchange_bool_acq (similar to atomic_compare_exchange_weak).
That's not quite true. See my other response.
> 479: unclear specification of mtx_trylock on non-recursive muteness
> 480: cnd_wait and cnd_timewait should allow spurious wake-ups
See my other response to this thread.