Date: Fri, 31 Dec 2004 15:12:33 GMT From: David Xu <davidxu@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 67998 for review Message-ID: <200412311512.iBVFCXPt009903@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412311512.iBVFCXPt009903>