summaryrefslogtreecommitdiff
path: root/src/utils/mutex.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-05 22:26:38 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-05 22:30:19 +0100
commit06d0205bab253ec5d01e8483ab639a092fe117c5 (patch)
tree480a2f510f189d8d3a64a99b1eb94c8b5d1ca764 /src/utils/mutex.h
parent6ac9c3bce62a8fc79e23477417188108f0ad9fa6 (diff)
downloadmana-06d0205bab253ec5d01e8483ab639a092fe117c5.tar.gz
mana-06d0205bab253ec5d01e8483ab639a092fe117c5.tar.bz2
mana-06d0205bab253ec5d01e8483ab639a092fe117c5.tar.xz
mana-06d0205bab253ec5d01e8483ab639a092fe117c5.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.h13
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