diff options
author | Jim Carroll <thecarrolls@jiminger.com> | 2011-06-12 07:50:55 -0400 |
---|---|---|
committer | Jim Carroll <thecarrolls@jiminger.com> | 2011-06-23 10:15:26 -0400 |
commit | aa34a388d52dbd3fd007cc3885db3c823ee3e7e5 (patch) | |
tree | 2ce58ab386d9cb49607e6fc384507947ca7c8571 | |
parent | 1574345cb36f10c545062ac230d32b6edb83cbb4 (diff) |
Removed xbmc/threads/Mutex.h,cpp which was only used in one place and is totally redundant.
-rw-r--r-- | xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp | 9 | ||||
-rw-r--r-- | xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h | 4 | ||||
-rw-r--r-- | xbmc/threads/Makefile | 1 | ||||
-rw-r--r-- | xbmc/threads/Mutex.cpp | 76 | ||||
-rw-r--r-- | xbmc/threads/Mutex.h | 56 |
5 files changed, 5 insertions, 141 deletions
diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp index d85aed219e..b0ffac8357 100644 --- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp +++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp @@ -21,7 +21,6 @@ #include "EmuFileWrapper.h" #include "filesystem/File.h" -#include "threads/Mutex.h" #include "threads/SingleLock.h" CEmuFileWrapper g_emuFileWrapper; @@ -78,7 +77,7 @@ EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile) object->used = true; object->file_xbmc = pFile; object->file_emu._file = (i + FILE_WRAPPER_OFFSET); - object->file_lock = new CMutex(); + object->file_lock = new CCriticalSection(); break; } } @@ -126,7 +125,7 @@ void CEmuFileWrapper::LockFileObjectByDescriptor(int fd) { if (m_files[i].used) { - m_files[i].file_lock->Wait(); + m_files[i].file_lock->lock(); } } } @@ -138,7 +137,7 @@ bool CEmuFileWrapper::TryLockFileObjectByDescriptor(int fd) { if (m_files[i].used) { - return m_files[i].file_lock->WaitMSec(0); + return m_files[i].file_lock->try_lock(); } } return false; @@ -151,7 +150,7 @@ void CEmuFileWrapper::UnlockFileObjectByDescriptor(int fd) { if (m_files[i].used) { - m_files[i].file_lock->Release(); + m_files[i].file_lock->unlock(); } } } diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h index 496b870a18..bc1a479bf2 100644 --- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h +++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h @@ -28,8 +28,6 @@ #include "system.h" #include "threads/CriticalSection.h" -class CMutex; - #if defined(_LINUX) && !defined(__APPLE__) && !defined(__FreeBSD__) #define _file _fileno #endif @@ -47,7 +45,7 @@ typedef struct stEmuFileObject bool used; FILE file_emu; XFILE::CFile* file_xbmc; - CMutex *file_lock; + CCriticalSection *file_lock; int mode; } EmuFileObject; diff --git a/xbmc/threads/Makefile b/xbmc/threads/Makefile index bf64ddb51a..bdfb651170 100644 --- a/xbmc/threads/Makefile +++ b/xbmc/threads/Makefile @@ -1,6 +1,5 @@ SRCS=Atomics.cpp \ Event.cpp \ - Mutex.cpp \ LockFree.cpp \ Semaphore.cpp \ Thread.cpp \ diff --git a/xbmc/threads/Mutex.cpp b/xbmc/threads/Mutex.cpp deleted file mode 100644 index 1aaa7c7ea4..0000000000 --- a/xbmc/threads/Mutex.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * 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, 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 XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "Mutex.h" - - -CMutex::CMutex() -{ - m_hMutex = CreateMutex( NULL, FALSE, NULL); -} - -CMutex::CMutex( char* pName ) -{ - m_hMutex = CreateMutex( NULL, FALSE, pName); -} - -CMutex::~CMutex() -{ - CloseHandle(m_hMutex); - m_hMutex = NULL; -} - -bool CMutex::Wait() -{ - if (m_hMutex) - if (WAIT_OBJECT_0 == WaitForSingleObject(m_hMutex, INFINITE)) - return true; - return false; -} - -void CMutex::Release() -{ - if (m_hMutex) - ReleaseMutex(m_hMutex); -} - -CMutexWait::CMutexWait(CMutex& mutex) - : m_mutex(mutex) -{ - m_bLocked = m_mutex.Wait(); -} - -CMutexWait::~CMutexWait() -{ - if (m_bLocked) - m_mutex.Release(); -} - - -HANDLE CMutex::GetHandle() -{ - return m_hMutex; -} - -bool CMutex::WaitMSec(unsigned int milliSeconds) -{ - return m_hMutex && WaitForSingleObject(m_hMutex, milliSeconds) == WAIT_OBJECT_0; -}
\ No newline at end of file diff --git a/xbmc/threads/Mutex.h b/xbmc/threads/Mutex.h deleted file mode 100644 index 4ae52659e1..0000000000 --- a/xbmc/threads/Mutex.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * 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, 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 XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// CMutex - Wrapper for xbox Mutex API -// -// by Bobbin007 in 2003 - -#include "system.h" // for HANDLE - -class CMutex -{ -public: - CMutex(); - CMutex( char* pName ); - virtual ~CMutex(); - - HANDLE GetHandle(); - - void Release(); - - bool Wait(); - bool WaitMSec(unsigned int milliSeconds); - -protected: - HANDLE m_hMutex; -}; - -class CMutexWait -{ -public: - CMutexWait(CMutex& mutex); - virtual ~CMutexWait(); -private: - CMutex& m_mutex; - bool m_bLocked; -}; |