* thread.h (struct pthread_rwlock::RWLOCK_READER): Add counter n.

* thread.cc (pthread_rwlock::rdlock): If a thread already owns a
	read lock, just count the number of locks for it, per SUSv4.
	(pthread_rwlock::tryrdlock): Ditto.
	(pthread_rwlock::unlock): If a thread has more than one concurrent
	read locks, just count down.
This commit is contained in:
Corinna Vinschen
2009-01-20 12:40:31 +00:00
parent 3787b37ef2
commit f8190b5705
3 changed files with 26 additions and 4 deletions

View File

@ -556,6 +556,7 @@ public:
{
struct RWLOCK_READER *next;
pthread_t thread;
unsigned long n;
} *readers;
fast_mutex readers_mx;