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

Diff for /pegasus/src/Pegasus/Common/Mutex.cpp between version 1.11 and 1.12

version 1.11, 2008/08/14 17:44:27 version 1.12, 2008/08/15 17:24:52
Line 104 
Line 104 
     }     }
 } }
  
 void Mutex::try_lock()  Boolean Mutex::try_lock()
 { {
     PEGASUS_DEBUG_ASSERT(_magic);     PEGASUS_DEBUG_ASSERT(_magic);
  
     int r = pthread_mutex_trylock(&_rep.mutex);     int r = pthread_mutex_trylock(&_rep.mutex);
     if (r == -1)     if (r == -1)
         r=errno;         r=errno;
     switch (r)  
       if (r == 0)
     {     {
         case 0:  
 #if defined(PEGASUS_DEBUG) #if defined(PEGASUS_DEBUG)
             _rep.count++;             _rep.count++;
 #endif #endif
             break;          return true;
       }
  
         case EBUSY:      if (r == EBUSY)
             throw AlreadyLocked(Threads::self());      {
           return false;
       }
  
         default:  
             throw WaitFailed(Threads::self());             throw WaitFailed(Threads::self());
     }     }
 }  
  
 Boolean Mutex::timed_lock(Uint32 milliseconds) Boolean Mutex::timed_lock(Uint32 milliseconds)
 { {
Line 252 
Line 253 
     _rep.count++;     _rep.count++;
 } }
  
 void Mutex::try_lock()  Boolean Mutex::try_lock()
 { {
     PEGASUS_DEBUG_ASSERT(_magic);     PEGASUS_DEBUG_ASSERT(_magic);
  
     DWORD rc = WaitForSingleObject(_rep.handle, 0);     DWORD rc = WaitForSingleObject(_rep.handle, 0);
  
     if (rc == WAIT_TIMEOUT)     if (rc == WAIT_TIMEOUT)
         throw AlreadyLocked(Threads::self());      {
           return false;
       }
  
     if (rc == WAIT_FAILED)     if (rc == WAIT_FAILED)
       {
         throw WaitFailed(Threads::self());         throw WaitFailed(Threads::self());
       }
  
     _rep.count++;     _rep.count++;
       return true;
 } }
  
 Boolean Mutex::timed_lock(Uint32 milliseconds) Boolean Mutex::timed_lock(Uint32 milliseconds)


Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2