summaryrefslogtreecommitdiff
path: root/barrier.c
diff options
context:
space:
mode:
authorrpj <rpj>2001-07-06 18:16:50 +0000
committerrpj <rpj>2001-07-06 18:16:50 +0000
commit06974b302eaf8f08382e6e786aea53f420c12222 (patch)
tree1b574a41dacc634a105a74127b2dac30a60bda13 /barrier.c
parent7a3104dc65b469cbb9c88b6a9c7b7bea4126a43e (diff)
Spinlocks and barriers fixed and working. Beta level.
* spin.c: Revamped and working; included static initialiser. * barrier.c: Likewise. * condvar.c: Macro constant change; inline auto init routine. * mutex.c: Likewise. * rwlock.c: Likewise. * private.c: Add support for spinlock initialiser. * global.c: Likewise. * implement.h: Likewise. * pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Fix typo. tests/ChangeLog: * spin3.c: Changed test and fixed. * spin4.c: Fixed. * barrier3.c: Fixed. * barrier4.c: Fixed.
Diffstat (limited to 'barrier.c')
-rw-r--r--barrier.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/barrier.c b/barrier.c
index 7d148ed..41bcf07 100644
--- a/barrier.c
+++ b/barrier.c
@@ -148,22 +148,22 @@ pthread_barrier_wait(pthread_barrier_t *barrier)
}
else
{
+ pthread_t self;
+ int oldCancelState;
+
+ (void) pthread_mutex_unlock(&(b->mtxExclusiveAccess));
+
+ self = pthread_self();
+
/*
* pthread_barrier_wait() is not a cancelation point
* so temporarily prevent sem_wait() from being one.
*/
- pthread_t self = pthread_self();
- int oldCancelState;
-
if (self->cancelType == PTHREAD_CANCEL_DEFERRED)
{
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldCancelState);
}
- /* Could still be PTHREAD_CANCEL_ASYNCHRONOUS. */
- pthread_cleanup_push(pthread_mutex_unlock,
- (void *) &(b->mtxExclusiveAccess));
-
if (0 != sem_wait(&(b->semBarrierBreeched)))
{
result = errno;
@@ -173,8 +173,6 @@ pthread_barrier_wait(pthread_barrier_t *barrier)
{
pthread_setcancelstate(oldCancelState, NULL);
}
-
- pthread_cleanup_pop(1);
}
}