mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-12-23 11:21:49 +01:00
Replace CMutex class by std::recursive_mutex
This commit is contained in:
parent
4862b6ba93
commit
043089f48a
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CThread.h"
|
#include "CThread.h"
|
||||||
#include "CMutex.h"
|
|
||||||
#include <wut_types.h>
|
#include <wut_types.h>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
class BackgroundThreadWrapper: public CThread {
|
class BackgroundThreadWrapper: public CThread {
|
||||||
public:
|
public:
|
||||||
@ -16,7 +16,7 @@ protected:
|
|||||||
void setThreadPriority(int32_t priority) {
|
void setThreadPriority(int32_t priority) {
|
||||||
this->setThreadPriority(priority);
|
this->setThreadPriority(priority);
|
||||||
}
|
}
|
||||||
CMutex mutex;
|
std::recursive_mutex mutex;
|
||||||
private:
|
private:
|
||||||
void executeThread();
|
void executeThread();
|
||||||
|
|
||||||
|
@ -1,69 +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 <http://www.gnu.org/licenses/>.
|
|
||||||
****************************************************************************/
|
|
||||||
#ifndef _CMUTEX_H_
|
|
||||||
#define _CMUTEX_H_
|
|
||||||
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <coreinit/mutex.h>
|
|
||||||
|
|
||||||
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_
|
|
Loading…
Reference in New Issue
Block a user