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

Diff for /pegasus/src/Pegasus/Common/ReadWriteSem.cpp between version 1.2 and 1.5.4.1

version 1.2, 2006/08/09 21:12:42 version 1.5.4.1, 2008/02/21 06:33:19
Line 29 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Day (mdday@us.ibm.com)  
 //  
 // Reworked By: Mike Brasher (m.brasher@inovadevelopment.com)  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include "ReadWriteSem.h" #include "ReadWriteSem.h"
Line 58 
Line 54 
  
 ReadWriteSem::~ReadWriteSem() ReadWriteSem::~ReadWriteSem()
 { {
       int r = 0;
     while (EBUSY == pthread_rwlock_destroy(&_rwlock.rwlock))      while ((r=pthread_rwlock_destroy(&_rwlock.rwlock)) == EBUSY ||
              (r == -1 && errno == EBUSY))
     {     {
         Threads::yield();         Threads::yield();
     }     }
Line 116 
Line 113 
     }     }
     else     else
         throw(Permission(Threads::self()));         throw(Permission(Threads::self()));
       if (errorcode == -1)
           errorcode = errno;
     if (errorcode == EBUSY)     if (errorcode == EBUSY)
         throw(AlreadyLocked(_rwlock.owner));         throw(AlreadyLocked(_rwlock.owner));
     else if (errorcode == EDEADLK)     else if (errorcode == EDEADLK)
Line 147 
Line 145 
         do         do
         {         {
             errorcode = pthread_rwlock_tryrdlock(&_rwlock.rwlock);             errorcode = pthread_rwlock_tryrdlock(&_rwlock.rwlock);
               if (errorcode == -1)
                   errorcode = errno;
             gettimeofday(&now, NULL);             gettimeofday(&now, NULL);
         }         }
         while (errorcode == EBUSY &&         while (errorcode == EBUSY &&
Line 162 
Line 162 
         do         do
         {         {
             errorcode = pthread_rwlock_trywrlock(&_rwlock.rwlock);             errorcode = pthread_rwlock_trywrlock(&_rwlock.rwlock);
               if (errorcode == -1)
                   errorcode = errno;
             gettimeofday(&now, NULL);             gettimeofday(&now, NULL);
         }         }
         while (errorcode == EBUSY &&         while (errorcode == EBUSY &&
Line 206 
Line 208 
  
 int ReadWriteSem::read_count() const int ReadWriteSem::read_count() const
 { {
     return (_readers.get());      return _readers.get();
 } }
  
 int ReadWriteSem::write_count() const int ReadWriteSem::write_count() const
 { {
     return (_writers.get());      return _writers.get();
 } }
  
 #endif /* PEGASUS_USE_POSIX_RWLOCK */ #endif /* PEGASUS_USE_POSIX_RWLOCK */
Line 516 
Line 518 
         Threads::cleanup_pop(0);         Threads::cleanup_pop(0);
     }     }
  
     if (Threads::id(caught.get_owner()) != 0)      if (!Threads::null(caught.get_owner()))
         throw caught;         throw caught;
     if (Threads::id(caughtWaitFailed.get_owner()) != 0)      if (!Threads::null(caughtWaitFailed.get_owner()))
         throw caughtWaitFailed;         throw caughtWaitFailed;
     if (Threads::id(caughtTimeOut.get_owner()) != 0)      if (!Threads::null(caughtTimeOut.get_owner()))
         throw caughtTimeOut;         throw caughtTimeOut;
     if (Threads::id(caughtTooManyReaders.get_owner()) != 0)      if (!Threads::null(caughtTooManyReaders.get_owner()))
   
         throw caughtTooManyReaders;         throw caughtTooManyReaders;
     return;     return;
 } }
Line 555 
Line 558 
  
 int ReadWriteSem::read_count() const int ReadWriteSem::read_count() const
 { {
     return (_readers.get());      return _readers.get();
 } }
  
 int ReadWriteSem::write_count() const int ReadWriteSem::write_count() const
 { {
     return (_writers.get());      return _writers.get();
 } }
  
 #endif /* !PEGASUS_USE_SEMAPHORE_RWLOCK */ #endif /* !PEGASUS_USE_SEMAPHORE_RWLOCK */


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5.4.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2