Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Nov 2010 00:42:33 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r214967 - user/davidxu/libthr/lib/libthr/thread
Message-ID:  <201011080042.oA80gXAC097905@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



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