Removed xbmc/threads/Mutex.h,cpp which was only used in one place and is totally...
authorJim Carroll <thecarrolls@jiminger.com>
Sun, 12 Jun 2011 11:50:55 +0000 (07:50 -0400)
committerJim Carroll <thecarrolls@jiminger.com>
Thu, 23 Jun 2011 14:15:26 +0000 (10:15 -0400)
xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp
xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h
xbmc/threads/Makefile
xbmc/threads/Mutex.cpp [deleted file]
xbmc/threads/Mutex.h [deleted file]

index d85aed2..b0ffac8 100644 (file)
@@ -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();
     }
   }
 }
index 496b870..bc1a479 100644 (file)
@@ -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;
 
index bf64ddb..bdfb651 100644 (file)
@@ -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 (file)
index 1aaa7c7..0000000
+++ /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 (file)
index 4ae5265..0000000
+++ /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;
-};