[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

pthread_rwlock behaviour



Hello,
	I have been using the NPTL with my code for a while and came across
the following situation:

#include <stdio.h>
#include <pthread.h>

int main() {

	pthread_rwlock_t lock;

	pthread_rwlock_init(&lock,NULL);

	fprintf(stderr,"doing write lock\n");

	pthread_rwlock_wrlock(&lock);

	fprintf(stderr,"doing unlock twice\n");

	pthread_rwlock_unlock(&lock);
	pthread_rwlock_unlock(&lock);

	fprintf(stderr,"doing write lock again\n");

	pthread_rwlock_wrlock(&lock);

	fprintf(stderr,"finished\n");

}

Now this causes the code to stop on the last call to
pthread_rwlock_wrlock(). I was wondering whether this was intentional or
not? The old pthreads implementation used to be quite happy with the double
pthread_rwlock_unlock() call.

Regards,

Ian Campbell




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]