diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-05 22:26:38 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-05 15:55:31 -0700 |
commit | 032f7659014d265a3c34765da2f277b7b0f32691 (patch) | |
tree | 2ac9b405c6d820dab72b8c5810127cf0cf46e25d /src/utils/mutex.h | |
parent | 7d5bfc11b5e467b502a3b56e853200b887859808 (diff) | |
download | mana-032f7659014d265a3c34765da2f277b7b0f32691.tar.gz mana-032f7659014d265a3c34765da2f277b7b0f32691.tar.bz2 mana-032f7659014d265a3c34765da2f277b7b0f32691.tar.xz mana-032f7659014d265a3c34765da2f277b7b0f32691.zip |
Fixed MutexLocker to not work on a copy
The Mutex class wasn't meant to be copied around. Silly last minute
refactorings leading to untested code...
Diffstat (limited to 'src/utils/mutex.h')
-rw-r--r-- | src/utils/mutex.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/utils/mutex.h b/src/utils/mutex.h index 6c35987c..62c6b4e1 100644 --- a/src/utils/mutex.h +++ b/src/utils/mutex.h @@ -40,6 +40,9 @@ public: void unlock(); private: + Mutex(const Mutex&); // prevent copying + Mutex& operator=(const Mutex&); + SDL_mutex *mMutex; }; @@ -49,11 +52,11 @@ private: class MutexLocker { public: - MutexLocker(Mutex mutex); + MutexLocker(Mutex *mutex); ~MutexLocker(); private: - Mutex mMutex; + Mutex *mMutex; }; @@ -80,15 +83,15 @@ inline void Mutex::unlock() } -inline MutexLocker::MutexLocker(Mutex mutex): +inline MutexLocker::MutexLocker(Mutex *mutex): mMutex(mutex) { - mMutex.lock(); + mMutex->lock(); } inline MutexLocker::~MutexLocker() { - mMutex.unlock(); + mMutex->unlock(); } #endif // TMW_MUTEX_H |