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

Diff for /pegasus/src/Pegasus/Common/Mutex.h between version 1.4.2.5 and 1.4.2.10

version 1.4.2.5, 2006/07/30 22:51:02 version 1.4.2.10, 2006/08/01 20:29:59
Line 29 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (m.brasher@inovadevelopment.com)  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #ifndef Pegasus_Mutex_h #ifndef Pegasus_Mutex_h
Line 52 
Line 50 
  
 #if defined(PEGASUS_HAVE_PTHREADS) #if defined(PEGASUS_HAVE_PTHREADS)
 typedef pthread_mutex_t MutexType; typedef pthread_mutex_t MutexType;
   inline void mutex_lock(MutexType* mutex) { pthread_mutex_lock(mutex); }
   inline void mutex_unlock(MutexType* mutex) { pthread_mutex_unlock(mutex); }
 struct MutexRep struct MutexRep
 { {
     MutexType mutex;      pthread_mutex_t mutex;
       int count;
 }; };
 inline void mutex_lock(MutexType* mutex) { pthread_mutex_lock(mutex); }  
 inline void mutex_unlock(MutexType* mutex) { pthread_mutex_unlock(mutex); }  
 inline void mutex_destroy(MutexType* mutex) { pthread_mutex_destroy(mutex); }  
 # define PEGASUS_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER # define PEGASUS_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
 #endif #endif
  
 #if defined(PEGASUS_HAVE_WINDOWS_THREADS) #if defined(PEGASUS_HAVE_WINDOWS_THREADS)
 typedef HANDLE MutexType; typedef HANDLE MutexType;
   inline void mutex_lock(MutexType* m) { WaitForSingleObject(*m, INFINITE); }
   inline void mutex_unlock(MutexType* m) { ReleaseMutex(*m); }
 struct MutexRep struct MutexRep
 { {
     MutexType handle;     MutexType handle;
     size_t count;     size_t count;
 }; };
 inline void mutex_lock(MutexType* m) { WaitForSingleObject(*m, INFINITE); }  
 inline void mutex_unlock(MutexType* m) { ReleaseMutex(*m); }  
 # define PEGASUS_MUTEX_INITIALIZER (CreateMutex(NULL, FALSE, NULL)) # define PEGASUS_MUTEX_INITIALIZER (CreateMutex(NULL, FALSE, NULL))
 #endif #endif
  
Line 86 
Line 84 
  
     Mutex();     Mutex();
  
     ~Mutex()      ~Mutex();
     {  
         mutex_destroy(&_rep.mutex);  
     }  
  
     void lock()      void lock();
     {  
         mutex_lock(&_rep.mutex);  
     }  
  
     void try_lock();     void try_lock();
  
     void timed_lock(Uint32 milliseconds);     void timed_lock(Uint32 milliseconds);
  
     void unlock()      void unlock();
     {  
         mutex_unlock(&_rep.mutex);  
     }  
  
 private: private:
     Mutex(const Mutex&);     Mutex(const Mutex&);
     Mutex& operator=(const Mutex&);     Mutex& operator=(const Mutex&);
  
   
     MutexRep _rep;     MutexRep _rep;
     Magic<0x57D11485> _magic;     Magic<0x57D11485> _magic;
  
Line 136 
Line 124 
         _mutex.unlock();         _mutex.unlock();
     }     }
  
     void lock()  
     {  
         _mutex.lock();  
     }  
   
     void unlock()  
     {  
         _mutex.unlock();  
     }  
   
 private: private:
     AutoMutex();      AutoMutex(); // Unimplemented
     AutoMutex(const AutoMutex& x);      AutoMutex(const AutoMutex& x); // Unimplemented
     AutoMutex& operator=(const AutoMutex& x);      AutoMutex& operator=(const AutoMutex& x); // Unimplemented
  
     Mutex& _mutex;     Mutex& _mutex;
 }; };


Legend:
Removed from v.1.4.2.5  
changed lines
  Added in v.1.4.2.10

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2