* thread.cc (pthread_rwlock::add_reader): Perform new operation here and return
pointer to allocated RWLOCK_READER structure. (pthread_rwlock::rdlock): Reorganize to reflect new add_reader functionality. (pthread_rwlock::tryrdlock): Ditto. Remove unneeded call to lookup_reader(). * thread.h (pthread_rwlock::RWLOCK_READER::RWLOCK_READER): New constructor. (pthread_rwlock::add_reader): Reflect new functionality.
This commit is contained in:
@@ -555,6 +555,7 @@ public:
|
||||
struct RWLOCK_READER *next;
|
||||
pthread_t thread;
|
||||
unsigned long n;
|
||||
RWLOCK_READER (): next (NULL), thread (pthread::self ()), n (0) {}
|
||||
} *readers;
|
||||
fast_mutex readers_mx;
|
||||
|
||||
@@ -583,7 +584,7 @@ public:
|
||||
private:
|
||||
static List<pthread_rwlock> rwlocks;
|
||||
|
||||
void add_reader (struct RWLOCK_READER *rd);
|
||||
RWLOCK_READER *add_reader ();
|
||||
void remove_reader (struct RWLOCK_READER *rd);
|
||||
struct RWLOCK_READER *lookup_reader (pthread_t thread);
|
||||
|
||||
|
Reference in New Issue
Block a user