From 1298418a302ba410927dac8bbf0ba84b7be9fe0e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Oct 2008 17:05:05 +0200 Subject: [PATCH] Removed unused code. --- src/game/Unit.h | 1 - src/shared/Mthread.cpp | 205 ------------------------------------------------- src/shared/Mthread.h | 62 --------------- win/VC90/shared.vcproj | 8 -- win/mangosdVC71.sln | 9 --- win/mangosdVC80.sln | 11 --- win/mangosdVC90.sln | 13 +--- 7 files changed, 1 insertion(+), 308 deletions(-) delete mode 100644 src/shared/Mthread.cpp delete mode 100644 src/shared/Mthread.h diff --git a/src/game/Unit.h b/src/game/Unit.h index c4495a282..6eb643843 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -22,7 +22,6 @@ #include "Common.h" #include "Object.h" #include "Opcodes.h" -#include "Mthread.h" #include "SpellAuraDefines.h" #include "UpdateFields.h" #include "SharedDefines.h" diff --git a/src/shared/Mthread.cpp b/src/shared/Mthread.cpp deleted file mode 100644 index 0dfaac4fc..000000000 --- a/src/shared/Mthread.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - Cross-platform thread handling - Copyright (C) 2005 Andrew Zabolotny - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "Mthread.h" - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE_CC__) -# define MANGOS_PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE -#else -# define MANGOS_PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP -#endif - -#if PLATFORM != PLATFORM_WINDOWS - -MThread::MThread () -{ - tid = 0; -} - -MThread::~MThread () -{ - /* Kill thread if this is not the current thread */ - if (tid && (pthread_self () != tid)) - { - pthread_cancel (tid); - pthread_join (tid, NULL); - } -} - -static void *thread_start_routine (void *arg) -{ - MThread *newthr = (MThread *)arg; - pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - newthr->routine (newthr->arg); - return NULL; -} - -MThread *MThread::Start (void (*routine) (void *arg), void *arg) -{ - MThread *newthr = new MThread (); - newthr->routine = routine; - newthr->arg = arg; - int rc = pthread_create (&newthr->tid, NULL, thread_start_routine, newthr); - if (rc) - { - newthr->DecRef (); - return NULL; - } - - return newthr; -} - -pthread_mutexattr_t MMutex::attr; -int MMutex::attr_refcount = 0; - -MMutex::MMutex () -{ - if (!attr_refcount++) - { - pthread_mutexattr_init (&attr); - pthread_mutexattr_settype (&attr, MANGOS_PTHREAD_MUTEX_RECURSIVE); - } - - pthread_mutex_init (&mutex, &attr); -} - -MMutex::~MMutex () -{ - pthread_mutex_destroy (&mutex); - if (!--attr_refcount) - pthread_mutexattr_destroy (&attr); -} - -bool MMutex::Lock () -{ - return (pthread_mutex_lock (&mutex) == 0); -} - -bool MMutex::TryLock () -{ - return (pthread_mutex_trylock (&mutex) == 0); -} - -void MMutex::Unlock () -{ - pthread_mutex_unlock (&mutex); -} - -MMutex *MMutex::Create () -{ - return new MMutex (); -} - -#else //windows - -MThread::MThread() -{ - th = NULL; -} - -MThread::~MThread () -{ - /* Kill thread if this is not current thread */ - if (th && (GetCurrentThreadId () != id)) - { - TerminateThread (th, 0); - WaitForSingleObject (th, INFINITE); - CloseHandle (th); - } -} - -bool MThread::SetPriority (ThreadPriority prio) -{ - int p; - switch (prio) - { - case IDLE: p = THREAD_PRIORITY_IDLE; break; - case LOWER: p = THREAD_PRIORITY_LOWEST; break; - case LOW: p = THREAD_PRIORITY_BELOW_NORMAL; break; - case NORMAL: p = THREAD_PRIORITY_NORMAL; break; - case HIGH: p = THREAD_PRIORITY_ABOVE_NORMAL; break; - case HIGHER: p = THREAD_PRIORITY_HIGHEST; break; - case REALTIME: p = THREAD_PRIORITY_TIME_CRITICAL; break; - default: p = THREAD_PRIORITY_NORMAL; break; - } - return SetThreadPriority (th, p); -} - -static DWORD WINAPI thread_start_routine (void *arg) -//static void thread_start_routine (void *arg) -{ - MThread *newthr = (MThread *)arg; - newthr->id = GetCurrentThreadId (); - newthr->routine (newthr->arg); - return 0; -} - -MThread *MThread::Start (void (*routine) (void *arg), void *arg) -{ - DWORD dwtid; - MThread *newthr = new MThread (); - newthr->routine = routine; - newthr->arg = arg; - newthr->th = CreateThread (NULL, WIN32_THREAD_STACK_SIZE, thread_start_routine, newthr, 0, &dwtid); - //newthr->th = (HANDLE)_beginthread(thread_start_routine, 0, newthr); - if (!newthr->th) - { - newthr->DecRef (); - return NULL; - } - return newthr; -} - -MMutex::MMutex () -{ - sem = CreateMutex (NULL, FALSE, NULL); -} - -MMutex::~MMutex () -{ - CloseHandle (sem); -} - -bool MMutex::Lock () -{ - return (WaitForSingleObject (sem, INFINITE) != WAIT_FAILED); -} - -bool MMutex::TryLock () -{ - DWORD state = WaitForSingleObject (sem, 0); - return (state == WAIT_OBJECT_0) && (state != WAIT_ABANDONED); -} - -void MMutex::Unlock () -{ - ReleaseMutex (sem); -} - -MMutex *MMutex::Create () -{ - MMutex *mutex = new MMutex (); - if (!mutex->sem) - { - mutex->DecRef (); - return NULL; - } - return mutex; -} -#endif diff --git a/src/shared/Mthread.h b/src/shared/Mthread.h deleted file mode 100644 index 1afee4acd..000000000 --- a/src/shared/Mthread.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef MTHREAD_H -#define MTHREAD_H - -#include "Base.h" -#ifndef WIN32 -#include -#else -#include -//#include "Process.h" -#define WIN32_THREAD_STACK_SIZE 0x10000 -#endif - -enum ThreadPriority -{ - IDLE, - LOWER, - LOW, - NORMAL, - HIGH, - HIGHER, - REALTIME -}; - -class MThread: public Base -{ - public: - static MThread *Start (void (*routine) (void *arg), void *arg); - MThread (); - ~MThread (); - bool SetPriority (ThreadPriority prio); - - void (*routine) (void *arg); - void *arg; - - #ifdef WIN32 - HANDLE th; - ULONG id; - #else - pthread_t tid; - #endif - -}; - -class MMutex : public Base -{ - public: - - #ifdef WIN32 - HANDLE sem; - #else - pthread_mutex_t mutex; - static pthread_mutexattr_t attr; - static int attr_refcount; - #endif - static MMutex *Create (); - MMutex (); - virtual ~MMutex (); - virtual bool Lock (); - virtual bool TryLock (); - virtual void Unlock (); -}; -#endif // MTHREAD_H diff --git a/win/VC90/shared.vcproj b/win/VC90/shared.vcproj index cea47aa8f..87fc91996 100644 --- a/win/VC90/shared.vcproj +++ b/win/VC90/shared.vcproj @@ -550,14 +550,6 @@ > - - - - diff --git a/win/mangosdVC71.sln b/win/mangosdVC71.sln index b8039a4f9..3e5664e2a 100644 --- a/win/mangosdVC71.sln +++ b/win/mangosdVC71.sln @@ -8,7 +8,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "VC71\shared.vcproj", "{90297C34-F231-4DF4-848E-A74BCC0E40ED}" ProjectSection(ProjectDependencies) = postProject {BF6F5D0E-33A5-4E23-9E7D-DD481B7B5B9E} = {BF6F5D0E-33A5-4E23-9E7D-DD481B7B5B9E} - {803F488E-4C5A-4866-8D5C-1E6C03C007C2} = {803F488E-4C5A-4866-8D5C-1E6C03C007C2} {7C74F49E-FECA-1BAD-6757-8A6348EA12C8} = {7C74F49E-FECA-1BAD-6757-8A6348EA12C8} {DE0380F9-C910-4E99-A841-93550D0E61D7} = {DE0380F9-C910-4E99-A841-93550D0E61D7} EndProjectSection @@ -57,10 +56,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC71\sockets.vcp ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gensvnrevision", "VC71\gensvnrevision.vcproj", "{803F488E-4C5A-4866-8D5C-1E6C03C007C2}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACE_Wraper", "VC71\ACE_vc71.vcproj", "{7C74F49E-FECA-1BAD-6757-8A6348EA12C8}" ProjectSection(ProjectDependencies) = postProject EndProjectSection @@ -113,10 +108,6 @@ Global {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug.Build.0 = Debug|Win32 {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release.ActiveCfg = Release|Win32 {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release.Build.0 = Release|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug.ActiveCfg = Debug|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug.Build.0 = Debug|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release.ActiveCfg = Release|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release.Build.0 = Release|Win32 {7C74F49E-FECA-1BAD-6757-8A6348EA12C8}.Debug.ActiveCfg = Debug|Win32 {7C74F49E-FECA-1BAD-6757-8A6348EA12C8}.Debug.Build.0 = Debug|Win32 {7C74F49E-FECA-1BAD-6757-8A6348EA12C8}.Release.ActiveCfg = Release|Win32 diff --git a/win/mangosdVC80.sln b/win/mangosdVC80.sln index 8e77cb8fe..a9ca84697 100644 --- a/win/mangosdVC80.sln +++ b/win/mangosdVC80.sln @@ -11,7 +11,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "VC80\shared.vcpro {AD537C9A-FECA-1BAD-6757-8A6348EA12C8} = {AD537C9A-FECA-1BAD-6757-8A6348EA12C8} {262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480} {8072769E-CF10-48BF-B9E1-12752A5DAC6E} = {8072769E-CF10-48BF-B9E1-12752A5DAC6E} - {803F488E-4C5A-4866-8D5C-1E6C03C007C2} = {803F488E-4C5A-4866-8D5C-1E6C03C007C2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} EndProjectSection EndProject @@ -44,8 +43,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC80\g3dlite.vcp EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC80\sockets.vcproj", "{04BAF755-0D67-46F8-B1C6-77AE5368F3CB}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gensvnrevision", "VC80\gensvnrevision.vcproj", "{803F488E-4C5A-4866-8D5C-1E6C03C007C2}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACEWraper", "VC80\ACE_vc8.vcproj", "{AD537C9A-FECA-1BAD-6757-8A6348EA12C8}" EndProject Global @@ -136,14 +133,6 @@ Global {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.Build.0 = Release|Win32 {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.ActiveCfg = Release|x64 {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.Build.0 = Release|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|Win32.ActiveCfg = Debug|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|Win32.Build.0 = Debug|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|x64.ActiveCfg = Debug|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|x64.Build.0 = Debug|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|Win32.ActiveCfg = Release|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|Win32.Build.0 = Release|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|x64.ActiveCfg = Release|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|x64.Build.0 = Release|x64 {AD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|Win32.ActiveCfg = Debug|Win32 {AD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|Win32.Build.0 = Debug|Win32 {AD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/win/mangosdVC90.sln b/win/mangosdVC90.sln index 53c3dbce0..2c351c818 100644 --- a/win/mangosdVC90.sln +++ b/win/mangosdVC90.sln @@ -9,7 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "VC90\shared.vcpro ProjectSection(ProjectDependencies) = postProject {BF6F5D0E-33A5-4E23-9E7D-DD481B7B5B9E} = {BF6F5D0E-33A5-4E23-9E7D-DD481B7B5B9E} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} - {803F488E-4C5A-4866-8D5C-1E6C03C007C2} = {803F488E-4C5A-4866-8D5C-1E6C03C007C2} {BD537C9A-FECA-1BAD-6757-8A6348EA12C8} = {BD537C9A-FECA-1BAD-6757-8A6348EA12C8} {8072769E-CF10-48BF-B9E1-12752A5DAC6E} = {8072769E-CF10-48BF-B9E1-12752A5DAC6E} {262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480} @@ -44,9 +43,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC90\g3dlite.vcp EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC90\sockets.vcproj", "{04BAF755-0D67-46F8-B1C6-77AE5368F3CB}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gensvnrevision", "VC90\gensvnrevision.vcproj", "{803F488E-4C5A-4866-8D5C-1E6C03C007C2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACEWraper", "VC90\ACE_vc9.vcproj", "{BD537C9A-FECA-1BAD-6757-8A6348EA12C8}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACE_Wrappers", "VC90\ACE_vc9.vcproj", "{BD537C9A-FECA-1BAD-6757-8A6348EA12C8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -136,14 +133,6 @@ Global {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.Build.0 = Release|Win32 {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.ActiveCfg = Release|x64 {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.Build.0 = Release|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|Win32.ActiveCfg = Debug|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|Win32.Build.0 = Debug|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|x64.ActiveCfg = Debug|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug|x64.Build.0 = Debug|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|Win32.ActiveCfg = Release|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|Win32.Build.0 = Release|Win32 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|x64.ActiveCfg = Release|x64 - {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Release|x64.Build.0 = Release|x64 {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|Win32.ActiveCfg = Debug|Win32 {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|Win32.Build.0 = Debug|Win32 {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|x64.ActiveCfg = Debug|x64 -- 2.11.4.GIT