From 62c4c726ff1c35b8ae4733ef68f6014ebc5e17ec Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 5 Jul 2020 13:49:49 +0200 Subject: [PATCH] Replace CMutex by std::recursive_mutex --- src/menu/MainWindow.h | 4 +-- src/system/CMutex.h | 73 ------------------------------------------- 2 files changed, 2 insertions(+), 75 deletions(-) delete mode 100644 src/system/CMutex.h diff --git a/src/menu/MainWindow.h b/src/menu/MainWindow.h index 54e2879..8c1e4ee 100644 --- a/src/menu/MainWindow.h +++ b/src/menu/MainWindow.h @@ -20,8 +20,8 @@ #include #include +#include #include "gui/Gui.h" -#include "system/CMutex.h" #include "gui/GuiMainWindowScreen.h" class CVideo; @@ -140,7 +140,7 @@ private: GuiImage *pointerImg[4]; bool pointerValid[4]; - CMutex guiMutex; + std::recursive_mutex guiMutex; }; #endif //_MAIN_WINDOW_H_ diff --git a/src/system/CMutex.h b/src/system/CMutex.h deleted file mode 100644 index f7193d5..0000000 --- a/src/system/CMutex.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 Dimok - * - * 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 3 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, see . - ****************************************************************************/ -#ifndef _CMUTEX_H_ -#define _CMUTEX_H_ - -#include -#include - -class CMutex { -public: - CMutex() { - pMutex = (OSMutex *) malloc(sizeof(OSMutex)); - if (!pMutex) - return; - - OSInitMutex(pMutex); - } - - virtual ~CMutex() { - if (pMutex) - free(pMutex); - } - - void lock(void) { - if (pMutex) - OSLockMutex(pMutex); - } - - void unlock(void) { - if (pMutex) - OSUnlockMutex(pMutex); - } - - BOOL tryLock(void) { - if (!pMutex) - return false; - - return (OSTryLockMutex(pMutex) != 0); - } - -private: - OSMutex *pMutex; -}; - -class CMutexLock { -public: - CMutexLock() { - mutex.lock(); - } - - virtual ~CMutexLock() { - mutex.unlock(); - } - -private: - CMutex mutex; -}; - -#endif // _CMUTEX_H_