00001 #ifndef MT_SCOPED_MUTEX_LOCK_H 00002 #define MT_SCOPED_MUTEX_LOCK_H 00003 00004 #include "mutex.h" 00005 00006 namespace mt 00007 { 00008 00009 class scoped_mutex_lock 00010 { 00011 MT_PREVENT_COPY(scoped_mutex_lock) 00012 00013 public: 00014 00015 typedef scoped_mutex_lock this_type; 00016 typedef void base_type; 00017 00018 scoped_mutex_lock(mutex & m) : mtx(m) 00019 { 00020 this->mtx.lock(); 00021 } 00022 00023 ~scoped_mutex_lock(void) 00024 { 00025 this->mtx.unlock(); 00026 } 00027 00028 //jnoguera 14-12-2011 00029 //method added to mime QMutexLocker 00030 scoped_mutex_lock(mutex * m) : mtx( *m ) 00031 { 00032 this->mtx.lock(); 00033 } 00034 00035 00036 protected: 00037 00038 mutex & mtx; 00039 }; 00040 00041 } 00042 00043 #endif // MT_SCOPED_MUTEX_LOCK_H 00044 00045 00046 00047 00048 00049 /* 00050 #ifndef MT_SCOPED_MUTEX_LOCK_H 00051 #define MT_SCOPED_MUTEX_LOCK_H 00052 00053 #include "mutex.h" 00054 00055 namespace mt 00056 { 00057 00058 class scoped_mutex_lock 00059 { 00060 MT_PREVENT_COPY(scoped_mutex_lock) 00061 00062 public: 00063 00064 typedef scoped_mutex_lock this_type; 00065 typedef void base_type; 00066 00067 scoped_mutex_lock(mutex & m) : mtx(m) 00068 { 00069 this->mtx.lock(); 00070 } 00071 00072 ~scoped_mutex_lock(void) 00073 { 00074 this->mtx.unlock(); 00075 } 00076 00077 protected: 00078 00079 mutex & mtx; 00080 }; 00081 00082 } 00083 00084 #endif // MT_SCOPED_MUTEX_LOCK_H 00085 00086 */ 00087 00088