From 1cebd3326242d89a0819f5b00fece58db691932f Mon Sep 17 00:00:00 2001 From: Alejandro Marzini Date: Thu, 10 Jun 2010 03:18:16 +0000 Subject: Added an abstract version of MutexManager. Deleted DefaultMutexManager, now it's NullMutexManager. svn-id: r49556 --- backends/mutex/abstract-mutex.h | 41 ++++++++++++++++++++++++++++++ backends/mutex/default/default-mutex.cpp | 30 ---------------------- backends/mutex/default/default-mutex.h | 43 -------------------------------- backends/mutex/null/null-mutex.h | 39 +++++++++++++++++++++++++++++ backends/mutex/sdl/sdl-mutex.h | 4 +-- 5 files changed, 82 insertions(+), 75 deletions(-) create mode 100644 backends/mutex/abstract-mutex.h delete mode 100644 backends/mutex/default/default-mutex.cpp delete mode 100644 backends/mutex/default/default-mutex.h create mode 100644 backends/mutex/null/null-mutex.h (limited to 'backends/mutex') diff --git a/backends/mutex/abstract-mutex.h b/backends/mutex/abstract-mutex.h new file mode 100644 index 0000000000..b5e0263c09 --- /dev/null +++ b/backends/mutex/abstract-mutex.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef BACKENDS_MUTEX_ABSTRACT_H +#define BACKENDS_MUTEX_ABSTRACT_H + +#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.cpp b/backends/mutex/default/default-mutex.cpp deleted file mode 100644 index e10e9e8ade..0000000000 --- a/backends/mutex/default/default-mutex.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "backends/mutex/default/default-mutex.h" - -OSystem::MutexRef DefaultMutexManager::createMutex() { - return OSystem::MutexRef(); -} diff --git a/backends/mutex/default/default-mutex.h b/backends/mutex/default/default-mutex.h deleted file mode 100644 index 44aa8ee20f..0000000000 --- a/backends/mutex/default/default-mutex.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BACKENDS_MUTEX_DEFAULT_H -#define BACKENDS_MUTEX_DEFAULT_H - -#include "common/system.h" -#include "common/noncopyable.h" - -class DefaultMutexManager : Common::NonCopyable { -public: - virtual ~DefaultMutexManager() {} - - OSystem::MutexRef createMutex(); - void lockMutex(OSystem::MutexRef mutex) {} - void unlockMutex(OSystem::MutexRef mutex) {} - void deleteMutex(OSystem::MutexRef mutex); -}; - - -#endif diff --git a/backends/mutex/null/null-mutex.h b/backends/mutex/null/null-mutex.h new file mode 100644 index 0000000000..76bb595631 --- /dev/null +++ b/backends/mutex/null/null-mutex.h @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef BACKENDS_MUTEX_NULL_H +#define BACKENDS_MUTEX_NULL_H + +#include "backends/mutex/abstract-mutex.h" + +class NullMutexManager : MutexManager { +public: + OSystem::MutexRef createMutex() { return OSystem::MutexRef(); } + void lockMutex(OSystem::MutexRef mutex) {} + void unlockMutex(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); -- cgit v1.2.3