[Top][All Lists]

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

Re: Test-lock hang (not 100% reproducible) on GNU/Linux

From: Bruno Haible
Subject: Re: Test-lock hang (not 100% reproducible) on GNU/Linux
Date: Wed, 04 Jan 2017 00:43:17 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Pavel Raiskup wrote:
> POSIX says (for pthread_rwlock_wrlock()):
>     Implementations may favor writers over readers to avoid writer starvation.
> But that's too far from 'shall favor' spelling.

You must be looking at an old version of POSIX [1]. POSIX:2008 specifies [2]:

[TPS] If ... the threads involved in the lock are executing with the scheduling
      policies SCHED_FIFO or SCHED_RR, the calling thread shall not acquire the
      lock if a writer holds the lock or if writers of higher or equal priority
      are blocked on the lock; otherwise, the calling thread shall acquire the

That states pretty clearly that the goal is that if both threads have equal
priority, the "writer" thread gets the rwlock.

> It might be bug in libpthread, too, but based on the POSIX specs and manual
> pages, I am not sure whether this might be actually considered a bug.

At least a quality of implementation issue, IMO.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]