From owner-p4-projects@FreeBSD.ORG Fri Dec 31 15:12:34 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A833116A4D0; Fri, 31 Dec 2004 15:12:33 +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 6938016A4CE for ; Fri, 31 Dec 2004 15:12:33 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 55AE443D1D for ; Fri, 31 Dec 2004 15:12:33 +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 iBVFCX0H009906 for ; Fri, 31 Dec 2004 15:12:33 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iBVFCXPt009903 for perforce@freebsd.org; Fri, 31 Dec 2004 15:12:33 GMT (envelope-from davidxu@freebsd.org) Date: Fri, 31 Dec 2004 15:12:33 GMT Message-Id: <200412311512.iBVFCXPt009903@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 67998 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: Fri, 31 Dec 2004 15:12:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=67998 Change 67998 by davidxu@davidxu_tiger on 2004/12/31 15:12:07 follow changes made in header file. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_barrier.c#2 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_barrier.c#2 (text+ko) ==== @@ -81,10 +81,10 @@ return (ret); } - bar->b_waiters = 0; - bar->b_count = count; - bar->b_generation = 0; - *barrier = bar; + bar->b_waiters = 0; + bar->b_count = count; + bar->b_cycle = 0; + *barrier = bar; return (0); } @@ -92,7 +92,7 @@ int _pthread_barrier_wait(pthread_barrier_t *barrier) { - int ret, gen; + int ret, cycle; pthread_barrier_t bar; if (barrier == NULL || *barrier == NULL) @@ -104,18 +104,18 @@ if (++bar->b_waiters == bar->b_count) { /* Current thread is lastest thread */ - bar->b_generation++; + bar->b_cycle++; bar->b_waiters = 0; ret = _pthread_cond_broadcast(&bar->b_cond); if (ret == 0) ret = PTHREAD_BARRIER_SERIAL_THREAD; } else { - gen = bar->b_generation; + cycle = bar->b_cycle; do { ret = _pthread_cond_wait( &bar->b_cond, &bar->b_lock); - /* test generation to avoid bogus wakeup */ - } while (ret == 0 && gen == bar->b_generation); + /* test cycle to avoid bogus wakeup */ + } while (ret == 0 && cycle == bar->b_cycle); } _pthread_mutex_unlock(&bar->b_lock); return (ret);