summaryrefslogtreecommitdiff
path: root/rwlock.c
diff options
context:
space:
mode:
authorrpj <rpj>2001-07-18 14:00:56 +0000
committerrpj <rpj>2001-07-18 14:00:56 +0000
commit1dde0f532f346c9382ef706a254861fd23eda12a (patch)
treec8d2d9aea60ec918baad3e13224ce2c19b1539dc /rwlock.c
parentb3e91e9179a85320d6e4aa63780cb653ff6a5a0e (diff)
* rwlock.c (pthread_rwlock_wrlock): Is allowed to be
a cancelation point; re-enable deferred cancelability around the CV call.
Diffstat (limited to 'rwlock.c')
-rw-r--r--rwlock.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/rwlock.c b/rwlock.c
index 2cc94ce..7908ed3 100644
--- a/rwlock.c
+++ b/rwlock.c
@@ -378,21 +378,12 @@ pthread_rwlock_wrlock(pthread_rwlock_t * rwlock)
if (rwl->nSharedAccessCount > 0)
{
- /*
- * pthread_rwlock_wrlock() is not a cancelation point
- * so temporarily prevent pthread_cond_wait() from being one.
- */
- pthread_t self = pthread_self();
- int oldCancelState;
-
rwl->nCompletedSharedAccessCount = -rwl->nSharedAccessCount;
- if (self->cancelType == PTHREAD_CANCEL_DEFERRED)
- {
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldCancelState);
- }
-
- /* Could still be PTHREAD_CANCEL_ASYNCHRONOUS. */
+ /*
+ * This routine may be a cancelation point
+ * according to POSIX 1003.1j section 18.1.2.
+ */
pthread_cleanup_push(ptw32_rwlock_cancelwrwait, (void*)rwl);
do
@@ -402,11 +393,6 @@ pthread_rwlock_wrlock(pthread_rwlock_t * rwlock)
}
while (result == 0 && rwl->nCompletedSharedAccessCount < 0);
- if (self->cancelType == PTHREAD_CANCEL_DEFERRED)
- {
- pthread_setcancelstate(oldCancelState, NULL);
- }
-
pthread_cleanup_pop ((result != 0) ? 1 : 0);
if (result == 0)