Re: POSIX writer locks can't be recursive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux