about summary refs log tree commit diff
path: root/src/thread/pthread_barrier_wait.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-17 17:16:20 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-17 17:16:20 -0500
commite882756311c7b06e59fcc8e582f03852b7dcfd30 (patch)
treeaead1d2311ed1d3b68dd2b1f02ff6eed2c5ea2ea /src/thread/pthread_barrier_wait.c
parent4fd159568aa1852fbbe6c11d35ccecaec3715d7c (diff)
downloadmusl-e882756311c7b06e59fcc8e582f03852b7dcfd30.tar.gz
musl-e882756311c7b06e59fcc8e582f03852b7dcfd30.tar.xz
musl-e882756311c7b06e59fcc8e582f03852b7dcfd30.zip
reorganize pthread data structures and move the definitions to alltypes.h
this allows sys/types.h to provide the pthread types, as required by
POSIX. this design also facilitates forcing ABI-compatible sizes in
the arch-specific alltypes.h, while eliminating the need for
developers changing the internals of the pthread types to poke around
with arch-specific headers they may not be able to test.
Diffstat (limited to 'src/thread/pthread_barrier_wait.c')
-rw-r--r--src/thread/pthread_barrier_wait.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/thread/pthread_barrier_wait.c b/src/thread/pthread_barrier_wait.c
index 02c252ad..7bfadb95 100644
--- a/src/thread/pthread_barrier_wait.c
+++ b/src/thread/pthread_barrier_wait.c
@@ -5,27 +5,27 @@ int pthread_barrier_wait(pthread_barrier_t *b)
 	int cur;
 
 	/* Trivial case: count was set at 1 */
-	if (!b->__limit) return PTHREAD_BARRIER_SERIAL_THREAD;
+	if (!b->_b_limit) return PTHREAD_BARRIER_SERIAL_THREAD;
 
 	/* Wait for anyone still suspended at previous use of barrier */
-	while ((cur=b->__left))
-		__wait(&b->__left, &b->__waiters, cur, 0);
+	while ((cur=b->_b_left))
+		__wait(&b->_b_left, &b->_b_waiters, cur, 0);
 
 	/* If we are the last to reach barrier, reset it and wake others */
-	if (a_fetch_add(&b->__count, 1) == b->__limit) {
-		b->__left = b->__limit;
-		b->__count = 0;
-		__wake(&b->__count, -1, 0);
+	if (a_fetch_add(&b->_b_count, 1) == b->_b_limit) {
+		b->_b_left = b->_b_limit;
+		b->_b_count = 0;
+		__wake(&b->_b_count, -1, 0);
 		return PTHREAD_BARRIER_SERIAL_THREAD;
 	}
 
 	/* Wait for our peers to reach the barrier */
-	while ((cur=b->__count))
-		__wait(&b->__count, 0, cur, 0);
+	while ((cur=b->_b_count))
+		__wait(&b->_b_count, 0, cur, 0);
 
 	/* If we're the last to wake up and barrier is awaiting reuse */
-	if (a_fetch_add(&b->__left, -1) == 1 && b->__waiters)
-		__wake(&b->__left, -1, 0);
+	if (a_fetch_add(&b->_b_left, -1) == 1 && b->_b_waiters)
+		__wake(&b->_b_left, -1, 0);
 
 	return 0;
 }