From e9368790a3dbc625031312b4cb2dcb667d38970e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 25 Mar 2004 04:06:44 +0000 Subject: [PATCH] remove unused SDL mutex implementation --- stepmania/src/RageThreads.cpp | 66 ++--------------------------------- 1 file changed, 3 insertions(+), 63 deletions(-) diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index 97356d8285..02db79cf28 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -40,6 +40,7 @@ #include "archutils/Win32/crash.h" #endif +/* XXX: char*GetLockedMutexesForThisThread? */ #define MAX_THREADS 128 static vector *g_MutexList = NULL; /* watch out for static initialization order problems */ @@ -571,7 +572,8 @@ bool RageMutexImpl::IsLockedByThisThread() const return LockedBy == GetCurrentThreadId(); } -#elif defined(HAVE_LIBPTHREAD) +#else + #include struct RageMutexImpl { @@ -700,68 +702,6 @@ bool RageMutexImpl::IsLockedByThisThread() const { return LockedBy == SDL_ThreadID(); } - -#else -/* SDL implementation. */ -struct RageMutexImpl -{ - unsigned LockedBy; - volatile int LockCnt; - - SDL_mutex *mutex; - RageMutex *m_Parent; - - RageMutexImpl( RageMutex *parent ); - ~RageMutexImpl(); - - void Lock(); - void Unlock(); - bool IsLockedByThisThread() const; -}; - -RageMutexImpl::RageMutexImpl( RageMutex *parent ) -{ - mutex = SDL_CreateMutex(); - LockedBy = 0; - LockCnt = 0; - m_Parent = parent; -} - -RageMutexImpl::~RageMutexImpl() -{ - SDL_DestroyMutex(mutex); -} - - -void RageMutexImpl::Lock() -{ - if( LockedBy == SDL_ThreadID() ) - { - ++LockCnt; - return; - } - - SDL_LockMutex( mutex ); - LockedBy = SDL_ThreadID(); -} - -void RageMutexImpl::Unlock() -{ - if( LockCnt ) - { - --LockCnt; - return; - } - - LockedBy = 0; - SDL_UnlockMutex( mutex ); -} - -bool RageMutexImpl::IsLockedByThisThread() const -{ - return LockedBy == SDL_ThreadID(); -} - #endif static const int MAX_MUTEXES = 256;