From owner-p4-projects@FreeBSD.ORG Sat Feb 26 10:35:42 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 95E0716A4D0; Sat, 26 Feb 2005 10:35:42 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6507116A4CF for ; Sat, 26 Feb 2005 10:35:42 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D32743D54 for ; Sat, 26 Feb 2005 10:35:42 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j1QAZgK8074885 for ; Sat, 26 Feb 2005 10:35:42 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j1QAZffw074882 for perforce@freebsd.org; Sat, 26 Feb 2005 10:35:41 GMT (envelope-from davidxu@freebsd.org) Date: Sat, 26 Feb 2005 10:35:41 GMT Message-Id: <200502261035.j1QAZffw074882@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 71902 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Feb 2005 10:35:43 -0000 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);