library: libThread #include "TRWLock.h"

# TRWLock

class description - source file - inheritance tree (.pdf)

## class TRWLock : public TObject

| Inheritance Chart:

`TObject`

<-

`TRWLock`

        public:

                          TRWLock()
                          TRWLock(const TRWLock&)
                  virtual ~TRWLock()
           static TClass* Class()
          virtual TClass* IsA() const
                 TRWLock& operator=(const TRWLock&)
                    Int_t ReadLock()
                    Int_t ReadUnLock()
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                    Int_t WriteLock()
                    Int_t WriteUnLock()

### Data Members

        private:

               Int_t fReaders   number of readers
               Int_t fWriters   number of writers
              TMutex fMutex     rwlock mutex
          TCondition fLockFree  rwlock condition variable

## Class Description

     TRWLock

     This class implements a reader/writer lock. A rwlock allows
     a resource to be accessed by multiple reader threads but only
     one writer thread.

TRWLock() : fLockFree(&fMutex)

     Create reader/write lock.

Int_t ReadLock()

     Obtain a reader lock. Returns always 0.

Int_t ReadUnLock()

     Unlock reader lock. Returns -1 if thread was not locked,
     0 if everything ok.

Int_t WriteLock()

     Obtain a writer lock. Returns always 0.

Int_t WriteUnLock()

     Unlock writer lock. Returns -1 if thread was not locked,
     0 if everything ok.

### Inline Functions

                   void ~TRWLock()
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
                TRWLock TRWLock(const TRWLock&)
               TRWLock& operator=(const TRWLock&)

Author: Fons Rademakers 04/01/2000
Last update: root/thread:$Name: $:$Id: TRWLock.cxx,v 1.1.1.1 2000/05/16 17:00:48 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *