Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Mar 2012 00:22:29 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233103 - head/lib/libthr/thread
Message-ID:  <201203180022.q2I0MThr093557@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davidxu
Date: Sun Mar 18 00:22:29 2012
New Revision: 233103
URL: http://svn.freebsd.org/changeset/base/233103

Log:
  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.

Modified:
  head/lib/libthr/thread/thr_umtx.c

Modified: head/lib/libthr/thread/thr_umtx.c
==============================================================================
--- head/lib/libthr/thread/thr_umtx.c	Sat Mar 17 23:55:18 2012	(r233102)
+++ head/lib/libthr/thread/thr_umtx.c	Sun Mar 18 00:22:29 2012	(r233103)
@@ -154,13 +154,6 @@ __thr_umutex_timedlock(struct umutex *mt
 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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203180022.q2I0MThr093557>