summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2009-12-14 01:26:01 +0000
committermarcel <marcel@FreeBSD.org>2009-12-14 01:26:01 +0000
commit5c1d0ca7f5cbc1565b5ce338ca1af86d3b2f5c5d (patch)
tree42ae61d08bc1543ceffe1d63f34027181663e65b /lib/libthr/thread
parent9d3913ddbe027b28489f24483ee9b96aafab016c (diff)
downloadFreeBSD-src-5c1d0ca7f5cbc1565b5ce338ca1af86d3b2f5c5d.zip
FreeBSD-src-5c1d0ca7f5cbc1565b5ce338ca1af86d3b2f5c5d.tar.gz
Work-around a race condition on ia64 while unlocking a contested lock.
The race condition is believed to be in UMTX_OP_MUTEX_WAKE. On ia64, we simply go to the kernel to unlock. The big question is why this is only a race condition on ia64... MFC after: 3 days
Diffstat (limited to 'lib/libthr/thread')
-rw-r--r--lib/libthr/thread/thr_umtx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c
index 7c59bb7..5af923d 100644
--- a/lib/libthr/thread/thr_umtx.c
+++ b/lib/libthr/thread/thr_umtx.c
@@ -112,10 +112,13 @@ __thr_umutex_timedlock(struct umutex *mtx, uint32_t id,
int
__thr_umutex_unlock(struct umutex *mtx, uint32_t id)
{
+#ifndef __ia64__
+ /* XXX this logic has a race-condition on ia64. */
if ((mtx->m_flags & (UMUTEX_PRIO_PROTECT | UMUTEX_PRIO_INHERIT)) == 0) {
atomic_cmpset_rel_32(&mtx->m_owner, id | UMUTEX_CONTESTED, UMUTEX_CONTESTED);
return _umtx_op_err(mtx, UMTX_OP_MUTEX_WAKE, 0, 0, 0);
}
+#endif /* __ia64__ */
return _umtx_op_err(mtx, UMTX_OP_MUTEX_UNLOCK, 0, 0, 0);
}
OpenPOWER on IntegriCloud