diff options
author | davidxu <davidxu@FreeBSD.org> | 2012-03-18 00:22:29 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2012-03-18 00:22:29 +0000 |
commit | 7218f7cbc7eab316c5db18cea6d60696090ba3df (patch) | |
tree | 6d96f7ec3dde4b33f4e5099c509d26aed5ab513c /lib | |
parent | 16846fb575f3587f475039b902dd766dbd540f2a (diff) | |
download | FreeBSD-src-7218f7cbc7eab316c5db18cea6d60696090ba3df.zip FreeBSD-src-7218f7cbc7eab316c5db18cea6d60696090ba3df.tar.gz |
Some software think a mutex can be destroyed after it owned it, for
example, it uses a serialization point like following:
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
pthread_mutex_destroy(&muetx);
They think a previous lock holder should have already left the mutex and
is no longer referencing it, so they destroy it. To be maximum compatible
with such code, we use IA64 version to unlock the mutex in kernel, remove
the two steps unlocking code.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libthr/thread/thr_umtx.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index f32596f..3132880 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -154,13 +154,6 @@ __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); } |