This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/11588] pthread condvars are not priority inheritance aware
- From: "john.ogness at linutronix dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 20 Feb 2014 17:43:50 +0000
- Subject: [Bug nptl/11588] pthread condvars are not priority inheritance aware
- Auto-submitted: auto-generated
- References: <bug-11588-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=11588
John Ogness <john.ogness at linutronix dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |john.ogness at linutronix dot de
--- Comment #32 from John Ogness <john.ogness at linutronix dot de> ---
I believe there is an error in [PATCH 1/3 V3] where COND_PRIO_PROTECT will
clobber the CLOCKID in cond->__data.__nwaiters. This is because the
COND_PROTOCOL values are not shifted by COND_PROTOCOL_SHIFT before reading and
writing to __nwaiters.
I believe the switch cases in pthread_cond_init.c:__pthread_cond_init() should
look like this:
case PTHREAD_PRIO_INHERIT:
cond->__data.__nwaiters |= COND_PRIO_INHERIT << COND_PROTOCOL_SHIFT;
break;
case PTHREAD_PRIO_PROTECT:
cond->__data.__nwaiters |= COND_PRIO_PROTECT << COND_PROTOCOL_SHIFT;
break;
And the cond_lock() and cond_unlock() in cond-lock.h should look like this:
static inline void
cond_lock(pthread_cond_t *cond, int pshared)
{
if (pshared == LLL_PRIVATE
&& (((cond->__data.__nwaiters & COND_PROTOCOL_MASK) >>
COND_PROTOCOL_SHIFT)
== COND_PRIO_INHERIT))
lll_pi_lock (cond->__data.__lock, pshared);
else
lll_lock (cond->__data.__lock, pshared);
}
static inline void
cond_unlock(pthread_cond_t *cond, int pshared)
{
if (pshared == LLL_PRIVATE
&& (((cond->__data.__nwaiters & COND_PROTOCOL_MASK) >>
COND_PROTOCOL_SHIFT)
== COND_PRIO_INHERIT))
lll_pi_unlock (cond->__data.__lock, pshared);
else
lll_unlock (cond->__data.__lock, pshared);
}
--
You are receiving this mail because:
You are on the CC list for the bug.