(file) Return to ReadWriteSem.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/ReadWriteSem.h between version 1.5.2.1 and 1.6.2.1

version 1.5.2.1, 2007/10/05 01:40:13 version 1.6.2.1, 2008/06/03 13:59:18
Line 62 
Line 62 
 # define PEGASUS_USE_POSIX_RWLOCK # define PEGASUS_USE_POSIX_RWLOCK
 #elif defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) #elif defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC)
 # define PEGASUS_USE_POSIX_RWLOCK # define PEGASUS_USE_POSIX_RWLOCK
   #elif defined(PEGASUS_PLATFORM_SOLARIS_IX86_CC)
   # define PEGASUS_USE_POSIX_RWLOCK
   #elif defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC)
   # define PEGASUS_USE_POSIX_RWLOCK
 #elif defined(PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX) #elif defined(PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX)
 # define PEGASUS_USE_POSIX_RWLOCK # define PEGASUS_USE_POSIX_RWLOCK
 #elif defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) #elif defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
Line 134 
Line 138 
         wait(PEG_SEM_WRITE, caller);         wait(PEG_SEM_WRITE, caller);
     }     }
  
     // @exception Deadlock  
     // @exception Permission  
     // @exception AlreadyLocked  
     // @exception WaitFailed  
     inline void try_wait_read(ThreadType caller)  
     {  
         try_wait(PEG_SEM_READ, caller);  
     }  
   
     // @exception Deadlock  
     // @exception Permission  
     // @exception AlreadyLocked  
     // @exception WaitFailed  
     inline void try_wait_write(ThreadType caller)  
     {  
         try_wait(PEG_SEM_WRITE, caller);  
     }  
   
     // @exception Deadlock  
     // @exception Permission  
     // @exception TimeOut  
     // @exception WaitFailed  
     inline void timed_wait_read(ThreadType caller, int milliseconds)  
     {  
         timed_wait(PEG_SEM_READ, caller, milliseconds);  
     }  
   
     // @exception Deadlock  
     // @exception Permission  
     // @exception TimeOut  
     // @exception WaitFailed  
     inline void timed_wait_write(ThreadType caller, int milliseconds)  
     {  
         timed_wait(PEG_SEM_WRITE, caller, milliseconds);  
     }  
   
     // @exception Permission     // @exception Permission
     inline void unlock_read(ThreadType caller)     inline void unlock_read(ThreadType caller)
     {     {
Line 191 
Line 159 
     // @exception TooManyReaders     // @exception TooManyReaders
     void wait(Uint32 mode, ThreadType caller);     void wait(Uint32 mode, ThreadType caller);
  
     // @exception Deadlock  
     // @exception Permission  
     // @exception WaitFailed  
     // @exception TooManyReaders  
     void try_wait(Uint32 mode, ThreadType caller);  
   
     // @exception Timeout  
     // @exception Deadlock  
     // @exception Permission  
     // @exception WaitFailed  
     // @exception TooManyReaders  
     void timed_wait(Uint32 mode, ThreadType caller, int milliseconds);  
   
     // @exception Permission     // @exception Permission
     void unlock(Uint32 mode, ThreadType caller);     void unlock(Uint32 mode, ThreadType caller);
  
Line 262 
Line 217 
     ReadWriteSem & _rwsem;     ReadWriteSem & _rwsem;
 }; };
  
 //==============================================================================  
 //  
 // ConditionalReadLock  
 //  
 //     Like ReadLock but only locks/unlocks if cond parameter is true.  
 //  
 //==============================================================================  
   
 class ConditionalReadLock  
 {  
 public:  
   
     ConditionalReadLock(ReadWriteSem& sem, bool cond) : _sem(sem), _cond(cond)  
     {  
         if (_cond)  
             _sem.wait_read(Threads::self());  
     }  
   
     ~ConditionalReadLock()  
     {  
         if (_cond)  
             _sem.unlock_read(Threads::self());  
     }  
   
 private:  
     ReadWriteSem& _sem;  
     bool _cond;  
 };  
   
 //==============================================================================  
 //  
 // ConditionalWriteLock  
 //  
 //     Like WriteLock but only locks/unlocks if cond parameter is true.  
 //  
 //==============================================================================  
   
 class ConditionalWriteLock  
 {  
 public:  
   
     ConditionalWriteLock(ReadWriteSem& sem, bool cond) : _sem(sem), _cond(cond)  
     {  
         if (_cond)  
             _sem.wait_write(Threads::self());  
     }  
   
     ~ConditionalWriteLock()  
     {  
         if (_cond)  
             _sem.unlock_write(Threads::self());  
     }  
   
 private:  
     ReadWriteSem& _sem;  
     bool _cond;  
 };  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 #endif /* Pegasus_ReadWriteSem_h */ #endif /* Pegasus_ReadWriteSem_h */


Legend:
Removed from v.1.5.2.1  
changed lines
  Added in v.1.6.2.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2