aboutsummaryrefslogtreecommitdiff
path: root/backends/mutex
diff options
context:
space:
mode:
authorAlejandro Marzini2010-06-10 03:18:16 +0000
committerAlejandro Marzini2010-06-10 03:18:16 +0000
commit1cebd3326242d89a0819f5b00fece58db691932f (patch)
treead497f1a9e13191563fa0b417c4a7f89cb32c8b8 /backends/mutex
parent7b63e8ae2505897f5c275bf755ef8384b4cb91a4 (diff)
downloadscummvm-rg350-1cebd3326242d89a0819f5b00fece58db691932f.tar.gz
scummvm-rg350-1cebd3326242d89a0819f5b00fece58db691932f.tar.bz2
scummvm-rg350-1cebd3326242d89a0819f5b00fece58db691932f.zip
Added an abstract version of MutexManager. Deleted DefaultMutexManager, now it's NullMutexManager.
svn-id: r49556
Diffstat (limited to 'backends/mutex')
-rw-r--r--backends/mutex/abstract-mutex.h (renamed from backends/mutex/default/default-mutex.cpp)19
-rw-r--r--backends/mutex/null/null-mutex.h (renamed from backends/mutex/default/default-mutex.h)16
-rw-r--r--backends/mutex/sdl/sdl-mutex.h4
3 files changed, 23 insertions, 16 deletions
diff --git a/backends/mutex/default/default-mutex.cpp b/backends/mutex/abstract-mutex.h
index e10e9e8ade..b5e0263c09 100644
--- a/backends/mutex/default/default-mutex.cpp
+++ b/backends/mutex/abstract-mutex.h
@@ -23,8 +23,19 @@
*
*/
-#include "backends/mutex/default/default-mutex.h"
+#ifndef BACKENDS_MUTEX_ABSTRACT_H
+#define BACKENDS_MUTEX_ABSTRACT_H
-OSystem::MutexRef DefaultMutexManager::createMutex() {
- return OSystem::MutexRef();
-}
+#include "common/system.h"
+#include "common/noncopyable.h"
+
+class MutexManager : Common::NonCopyable {
+public:
+ virtual OSystem::MutexRef createMutex() = 0;
+ virtual void lockMutex(OSystem::MutexRef mutex) = 0;
+ virtual void unlockMutex(OSystem::MutexRef mutex) = 0;
+ virtual void deleteMutex(OSystem::MutexRef mutex) = 0;
+};
+
+
+#endif
diff --git a/backends/mutex/default/default-mutex.h b/backends/mutex/null/null-mutex.h
index 44aa8ee20f..76bb595631 100644
--- a/backends/mutex/default/default-mutex.h
+++ b/backends/mutex/null/null-mutex.h
@@ -23,21 +23,17 @@
*
*/
-#ifndef BACKENDS_MUTEX_DEFAULT_H
-#define BACKENDS_MUTEX_DEFAULT_H
+#ifndef BACKENDS_MUTEX_NULL_H
+#define BACKENDS_MUTEX_NULL_H
-#include "common/system.h"
-#include "common/noncopyable.h"
+#include "backends/mutex/abstract-mutex.h"
-class DefaultMutexManager : Common::NonCopyable {
+class NullMutexManager : MutexManager {
public:
- virtual ~DefaultMutexManager() {}
-
- OSystem::MutexRef createMutex();
+ OSystem::MutexRef createMutex() { return OSystem::MutexRef(); }
void lockMutex(OSystem::MutexRef mutex) {}
void unlockMutex(OSystem::MutexRef mutex) {}
- void deleteMutex(OSystem::MutexRef mutex);
+ void deleteMutex(OSystem::MutexRef mutex) {}
};
-
#endif
diff --git a/backends/mutex/sdl/sdl-mutex.h b/backends/mutex/sdl/sdl-mutex.h
index aad3032315..acd13a879d 100644
--- a/backends/mutex/sdl/sdl-mutex.h
+++ b/backends/mutex/sdl/sdl-mutex.h
@@ -26,9 +26,9 @@
#ifndef BACKENDS_MUTEX_SDL_H
#define BACKENDS_MUTEX_SDL_H
-#include "backends/mutex/default/default-mutex.h"
+#include "backends/mutex/abstract-mutex.h"
-class SdlMutexManager : public DefaultMutexManager {
+class SdlMutexManager : public MutexManager {
public:
OSystem::MutexRef createMutex();
void lockMutex(OSystem::MutexRef mutex);