summaryrefslogtreecommitdiff
path: root/rwlock.c
diff options
context:
space:
mode:
authorrpj <rpj>2001-07-05 17:04:39 +0000
committerrpj <rpj>2001-07-05 17:04:39 +0000
commit7a3104dc65b469cbb9c88b6a9c7b7bea4126a43e (patch)
tree524cc0af0d3fa262c2412cdda269185059b33c33 /rwlock.c
parentec27b9c8303540de6b5a8ebefee114f3cdd436f0 (diff)
Fixups to last commit.
Diffstat (limited to 'rwlock.c')
-rw-r--r--rwlock.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/rwlock.c b/rwlock.c
index c2d85d8..819507b 100644
--- a/rwlock.c
+++ b/rwlock.c
@@ -383,16 +383,13 @@ pthread_rwlock_wrlock(pthread_rwlock_t * rwlock)
* so temporarily prevent pthread_cond_wait() from being one.
*/
pthread_t self = pthread_self();
- int cancelType = pthread_getcanceltype(self);
int oldCancelState;
rwl->nCompletedSharedAccessCount = -rwl->nSharedAccessCount;
- if (cancelType == PTHREAD_CANCEL_DEFERRED)
+ if (self->cancelType == PTHREAD_CANCEL_DEFERRED)
{
- oldCancelState =
- pthread_setcancelstate(self,
- PTHREAD_CANCEL_DISABLED);
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldCancelState);
}
/* Could still be PTHREAD_CANCEL_ASYNCHRONOUS. */
@@ -405,9 +402,9 @@ pthread_rwlock_wrlock(pthread_rwlock_t * rwlock)
}
while (result == 0 && rwl->nCompletedSharedAccessCount < 0);
- if (cancelType == PTHREAD_CANCEL_DEFERRED)
+ if (self->cancelType == PTHREAD_CANCEL_DEFERRED)
{
- pthread_setcancelstate(self, oldCancelState);
+ pthread_setcancelstate(oldCancelState, NULL);
}
pthread_cleanup_pop ((result != 0) ? 1 : 0);