Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Feb 2005 10:35:41 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 71902 for review
Message-ID:  <200502261035.j1QAZffw074882@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=71902

Change 71902 by davidxu@davidxu_tiger on 2005/02/26 10:35:21

	Use actual waiter counter.

Affected files ...

.. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_barrier.c#5 edit
.. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_cond.c#15 edit

Differences ...

==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_barrier.c#5 (text+ko) ====

@@ -91,7 +91,7 @@
 		/* Current thread is lastest thread */
 		bar->b_waiters = 0;
 		bar->b_cycle++;
-		_thr_umtx_wake(&bar->b_cycle, INT_MAX);
+		_thr_umtx_wake(&bar->b_cycle, bar->b_count);
 		THR_UMTX_UNLOCK(curthread, &bar->b_lock);
 		ret = PTHREAD_BARRIER_SERIAL_THREAD;
 	} else {

==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_cond.c#15 (text+ko) ====

@@ -302,7 +302,7 @@
 {
 	struct pthread	*curthread = _get_curthread();
 	pthread_cond_t	cv;
-	int		ret = 0;
+	int		ret = 0, oldwaiters;
 
 	/*
 	 * If the condition variable is statically initialized, perform dynamic
@@ -322,10 +322,11 @@
 			cv->c_seqno++;
 			_thr_umtx_wake(&cv->c_seqno, 1);
 		} else {
+			oldwaiters = cv->c_waiters;
 			cv->c_wakeups += cv->c_waiters;
 			cv->c_waiters = 0;
 			cv->c_seqno++;
-			_thr_umtx_wake(&cv->c_seqno, INT_MAX);
+			_thr_umtx_wake(&cv->c_seqno, oldwaiters);
 		}
 	}
 	THR_LOCK_RELEASE(curthread, &cv->c_lock);



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