svn commit: r214967 - user/davidxu/libthr/lib/libthr/thread

David Xu davidxu at FreeBSD.org
Mon Nov 8 00:42:33 UTC 2010


Author: davidxu
Date: Mon Nov  8 00:42:32 2010
New Revision: 214967
URL: http://svn.freebsd.org/changeset/base/214967

Log:
  Oops, check c_refcount, if there is no time-shareing threads,
  we don't need wait.

Modified:
  user/davidxu/libthr/lib/libthr/thread/thr_cond.c

Modified: user/davidxu/libthr/lib/libthr/thread/thr_cond.c
==============================================================================
--- user/davidxu/libthr/lib/libthr/thread/thr_cond.c	Mon Nov  8 00:38:54 2010	(r214966)
+++ user/davidxu/libthr/lib/libthr/thread/thr_cond.c	Mon Nov  8 00:42:32 2010	(r214967)
@@ -140,6 +140,8 @@ _pthread_cond_destroy(pthread_cond_t *co
 		rval = EINVAL;
 	else {
 		cv = *cond;
+		if (cv->c_refcount == 0)
+			goto next;
 		_thr_umtx_lock_spin(&cv->c_lock);
 		while (cv->c_refcount != 0) {
 			cv->c_destroying = 1;
@@ -156,6 +158,7 @@ _pthread_cond_destroy(pthread_cond_t *co
 			_thr_umtx_lock_spin(&cv->c_lock);
 		}
 		_thr_umtx_unlock(&cv->c_lock);
+	next:
 		_thr_ucond_broadcast(&cv->c_kerncv);
 		*cond = THR_COND_DESTROYED;
 


More information about the svn-src-user mailing list