linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: mtk.manpages@gmail.com, Carlos O'Donell <carlos@redhat.com>,
	linux-man <linux-man@vger.kernel.org>
Subject: Re: POSIX writer locks can't be recursive
Date: Fri, 26 Jun 2020 10:54:35 +0200	[thread overview]
Message-ID: <8d7edc37-6b5f-1dd9-5f7f-b4e15a9ae39a@gmail.com> (raw)
In-Reply-To: <CAP01T764kz5T+m+8sV0o30enBL1TagF7RQSjU0XcVJ0PvL0PTg@mail.gmail.com>

Hi Carlos,

Could you comment here, as this was your text in pthread_rwlockattr_setkind_np(3)?

On 6/25/20 2:32 PM, Kumar Kartikeya Dwivedi wrote:
> Hi,
> In pthread_rwlockattr_setkind_np(3), the explanation for
> PTHREAD_RWLOCK_PREFER_WRITER_NP reads:
> 
>> This is ignored by glibc because the POSIX requirement to support
>> recursive writer locks would cause this option to create trivial
>> deadlocks;
> 
> I think this should be "reader locks" instead, since it is
> undefined[1] for a thread holding a write lock to call
> pthread_rwlock_wrlock(3) again (glibc returns EDEADLK, musl simply
> deadlocks). There's no such requirement in POSIX either. Please let me
> know if I'm missing something.
> 
> [1]: https://pubs.opengroup.org/onlinepubs/007908799/xsh/pthread_rwlock_wrlock.html

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

       reply	other threads:[~2020-06-26  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAP01T764kz5T+m+8sV0o30enBL1TagF7RQSjU0XcVJ0PvL0PTg@mail.gmail.com>
2020-06-26  8:54 ` Michael Kerrisk (man-pages) [this message]
2020-07-15 19:50   ` POSIX writer locks can't be recursive Michael Kerrisk (man-pages)
2020-07-16 19:50     ` [PATCH] pthread_rwlockattr_setkind_np.3: PTHREAD_RWLOCK_PREFER_WRITER_NP Carlos O'Donell
2020-07-17  8:05       ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d7edc37-6b5f-1dd9-5f7f-b4e15a9ae39a@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=carlos@redhat.com \
    --cc=linux-man@vger.kernel.org \
    --cc=memxor@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).