Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ReadersWritersLock Class Reference

#include <ReadersWritersLock.H>

List of all members.

Public Member Functions

 ReadersWritersLock (bool favorWriters) throw ()
 ~ReadersWritersLock () throw ()
void acquireRead () throw ()
void releaseRead () throw ()
void acquireWrite () throw ()
void releaseWrite () throw ()
bool tryRead () throw ()
bool tryWrite () throw ()
bool release () throw ()

Private Attributes

Basics::mutex mu
int readers
int writers
RWLock_Queue_Itemq_head
RWLock_Queue_Itemq_tail
time_t acquire_time
pthread_t acquire_thread


Constructor & Destructor Documentation

ReadersWritersLock::ReadersWritersLock bool  favorWriters  )  throw ()
 

Definition at line 143 of file ReadersWritersLock.C.

ReadersWritersLock::~ReadersWritersLock  )  throw ()
 

Definition at line 94 of file ReadersWritersLock.C.

References acquireWrite(), Basics::mutex::lock(), mu, q_head, releaseWrite(), and Basics::mutex::unlock().


Member Function Documentation

void ReadersWritersLock::acquireRead  )  throw ()
 

Definition at line 170 of file ReadersWritersLock.C.

References acquire_thread, acquire_time, Basics::mutex::lock(), mu, RWLock_Queue_Item::my_turn, NEW_CONSTR, RWLock_Queue_Item::next, RWLock_Queue_Item::prev, q_head, q_tail, readers, RWLOCK_ACQUIRE_READ_DONE, RWLOCK_ACQUIRE_READ_START, Basics::mutex::unlock(), Basics::cond::wait(), RWLock_Queue_Item::waiting_count, RWLock_Queue_Item::writer, and writers.

Referenced by AccessControl::admit(), VDirVolatileRoot::createVolatileDirectory(), do_rename(), AccessControl::UnixIdentityRep::fill_caches(), AccessControl::GlobalIdentityRep::fill_caches(), GardenerThread(), AccessControl::globalToUnixGroup(), AccessControl::globalToUnixUser(), VDirVolatileRoot::lookupIndexAndLock(), AccessControl::unixToGlobalGroup(), and AccessControl::unixToGlobalUser().

void ReadersWritersLock::acquireWrite  )  throw ()
 

Definition at line 319 of file ReadersWritersLock.C.

References acquire_thread, acquire_time, Basics::mutex::lock(), mu, RWLock_Queue_Item::my_turn, RWLock_Queue_Item::next, RWLock_Queue_Item::prev, q_head, q_tail, readers, RWLOCK_ACQUIRE_WRITE_DONE, RWLOCK_ACQUIRE_WRITE_START, Basics::mutex::unlock(), Basics::cond::wait(), and writers.

Referenced by AcquireShortIdBlock(), AccessControl::admit(), CheckpointServer(), VDirVolatileRoot::createVolatileDirectory(), VDirVolatileRoot::deleteIndex(), DoDeletions(), GardenerThread(), LandlordThread(), VDirVolatileRoot::lockAll(), VDirVolatileRoot::lookupIndexAndLock(), ReleaseShortIdBlock(), RenewShortIdBlock(), SourceWeed(), VSAtomic(), and ~ReadersWritersLock().

bool ReadersWritersLock::release  )  throw ()
 

Definition at line 487 of file ReadersWritersLock.C.

References acquire_thread, acquire_time, Basics::cond::broadcast(), Basics::mutex::lock(), mu, RWLock_Queue_Item::my_turn, q_head, readers, RWLOCK_RELEASE_DONE, RWLOCK_RELEASE_START, Basics::mutex::unlock(), RWLock_Queue_Item::writer, and writers.

Referenced by do_hardlink(), Replicate(), ReplicateAttribs(), and ReplicationCleanup().

void ReadersWritersLock::releaseRead  )  throw ()
 

Definition at line 275 of file ReadersWritersLock.C.

References acquire_thread, acquire_time, Basics::cond::broadcast(), Basics::mutex::lock(), mu, RWLock_Queue_Item::my_turn, q_head, readers, RWLOCK_RELEASE_DONE, RWLOCK_RELEASE_START, and Basics::mutex::unlock().

Referenced by AccessControl::admit(), do_cow(), do_readlink(), do_rename(), AccessControl::UnixIdentityRep::fill_caches(), AccessControl::GlobalIdentityRep::fill_caches(), GardenerThread(), AccessControl::globalToUnixGroup(), AccessControl::globalToUnixUser(), AccessControl::unixToGlobalGroup(), AccessControl::unixToGlobalUser(), VSRead(), and VSStat().

void ReadersWritersLock::releaseWrite  )  throw ()
 

Definition at line 392 of file ReadersWritersLock.C.

References acquire_thread, acquire_time, Basics::cond::broadcast(), Basics::mutex::lock(), mu, RWLock_Queue_Item::my_turn, q_head, RWLOCK_RELEASE_DONE, RWLOCK_RELEASE_START, Basics::mutex::unlock(), and writers.

Referenced by AcquireMastership(), AcquireShortIdBlock(), AccessControl::admit(), CheckpointServer(), VDirVolatileRoot::createVolatileDirectory(), VDirVolatileRoot::deleteIndex(), do_hardlink(), do_mkdir(), do_remove(), do_rename(), do_setattr(), GardenerThread(), LandlordThread(), MakeFilesImmutable(), MutableSidrefCheck(), ReleaseShortIdBlock(), RenewShortIdBlock(), SetIndexMaster(), SourceWeed(), VDirVolatileRoot::unlockAll(), VSAtomic(), VSSetExecutable(), VSSetSize(), VSSetTimestamp(), VSWrite(), and ~ReadersWritersLock().

bool ReadersWritersLock::tryRead  )  throw ()
 

Definition at line 425 of file ReadersWritersLock.C.

References acquire_thread, acquire_time, Basics::mutex::lock(), mu, q_head, readers, RWLOCK_ACQUIRE_READ_DONE, RWLOCK_ACQUIRE_READ_START, Basics::mutex::unlock(), and writers.

bool ReadersWritersLock::tryWrite  )  throw ()
 

Definition at line 458 of file ReadersWritersLock.C.

References acquire_thread, acquire_time, Basics::mutex::lock(), mu, q_head, readers, RWLOCK_ACQUIRE_WRITE_DONE, RWLOCK_ACQUIRE_WRITE_START, Basics::mutex::unlock(), and writers.

Referenced by GardenerThread().


Member Data Documentation

pthread_t ReadersWritersLock::acquire_thread [private]
 

Definition at line 85 of file ReadersWritersLock.H.

Referenced by acquireRead(), acquireWrite(), release(), releaseRead(), releaseWrite(), tryRead(), and tryWrite().

time_t ReadersWritersLock::acquire_time [private]
 

Definition at line 84 of file ReadersWritersLock.H.

Referenced by acquireRead(), acquireWrite(), release(), releaseRead(), releaseWrite(), tryRead(), and tryWrite().

Basics::mutex ReadersWritersLock::mu [private]
 

Definition at line 70 of file ReadersWritersLock.H.

Referenced by acquireRead(), acquireWrite(), release(), releaseRead(), releaseWrite(), tryRead(), tryWrite(), and ~ReadersWritersLock().

RWLock_Queue_Item* ReadersWritersLock::q_head [private]
 

Definition at line 77 of file ReadersWritersLock.H.

Referenced by acquireRead(), acquireWrite(), release(), releaseRead(), releaseWrite(), tryRead(), tryWrite(), and ~ReadersWritersLock().

RWLock_Queue_Item * ReadersWritersLock::q_tail [private]
 

Definition at line 77 of file ReadersWritersLock.H.

Referenced by acquireRead(), and acquireWrite().

int ReadersWritersLock::readers [private]
 

Definition at line 74 of file ReadersWritersLock.H.

Referenced by acquireRead(), acquireWrite(), release(), releaseRead(), tryRead(), and tryWrite().

int ReadersWritersLock::writers [private]
 

Definition at line 75 of file ReadersWritersLock.H.

Referenced by acquireRead(), acquireWrite(), release(), releaseWrite(), tryRead(), and tryWrite().


The documentation for this class was generated from the following files:
Generated on Mon May 8 00:49:12 2006 for Vesta by  doxygen 1.4.2