(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.3.14.6 and 1.3.14.7

version 1.3.14.6, 2006/07/30 22:51:02 version 1.3.14.7, 2006/07/30 22:57:19
Line 63 
Line 63 
     pthread_mutex_init(&_rep.mutex, &_attr);     pthread_mutex_init(&_rep.mutex, &_attr);
 } }
  
   Mutex::~Mutex()
   {
       PEGASUS_DEBUG_ASSERT(_magic);
       pthread_mutex_destroy(&_rep.mutex);
   }
   
 void Mutex::try_lock() void Mutex::try_lock()
 { {
     PEGASUS_DEBUG_ASSERT(_magic);     PEGASUS_DEBUG_ASSERT(_magic);
Line 127 
Line 133 
     }     }
 } }
  
 #if 0  
 void Mutex::unlock()  
 {  
     PEGASUS_DEBUG_ASSERT(_magic);  
   
     if (pthread_mutex_unlock(&_rep.mutex) != 0)  
         throw Permission(ThreadType());  
 }  
 #endif  
   
 #endif /* PEGASUS_HAVE_PTHREADS */ #endif /* PEGASUS_HAVE_PTHREADS */
  
 //============================================================================== //==============================================================================
Line 151 
Line 147 
 { {
     _rep.handle = CreateMutex(NULL, FALSE, NULL);     _rep.handle = CreateMutex(NULL, FALSE, NULL);
     Threads::clear(ThreadType());     Threads::clear(ThreadType());
     _rep.count = 0;  
 } }
  
 Mutex::~Mutex() Mutex::~Mutex()
Line 162 
Line 157 
     CloseHandle(_rep.handle);     CloseHandle(_rep.handle);
 } }
  
 void Mutex::lock()  
 {  
     PEGASUS_DEBUG_ASSERT(_magic);  
   
     DWORD rc = WaitForSingleObject(_rep.handle, INFINITE);  
   
     if (rc == WAIT_FAILED)  
         throw WaitFailed(ThreadType());  
   
     _rep.count++;  
 }  
   
 void Mutex::try_lock() void Mutex::try_lock()
 { {
     PEGASUS_DEBUG_ASSERT(_magic);     PEGASUS_DEBUG_ASSERT(_magic);
Line 185 
Line 168 
  
     if (rc == WAIT_FAILED)     if (rc == WAIT_FAILED)
         throw WaitFailed(ThreadType());         throw WaitFailed(ThreadType());
   
     _rep.count++;  
 } }
  
 void Mutex::timed_lock(Uint32 milliseconds) void Mutex::timed_lock(Uint32 milliseconds)
Line 200 
Line 181 
  
     if (rc == WAIT_FAILED)     if (rc == WAIT_FAILED)
         throw WaitFailed(ThreadType());         throw WaitFailed(ThreadType());
   
     _rep.count++;  
 }  
   
 void Mutex::unlock()  
 {  
     PEGASUS_DEBUG_ASSERT(_magic);  
   
     Threads::clear(ThreadType());  
     _rep.count--;  
     ReleaseMutex(_rep.handle);  
 } }
  
 #endif /* PEGASUS_HAVE_WINDOWS_THREADS */ #endif /* PEGASUS_HAVE_WINDOWS_THREADS */


Legend:
Removed from v.1.3.14.6  
changed lines
  Added in v.1.3.14.7

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2