Remove mutex class and use std

This commit is contained in:
Ilusha 2024-01-17 22:42:48 +03:00 committed by Ilya Shurupov
parent b26310439d
commit 0b63045503
5 changed files with 5 additions and 22 deletions

View file

@ -27,7 +27,7 @@ ualni HeapAllocGlobal::getNAllocations() { return 0; }
tp::MemHead* tp::HeapAllocGlobal::mEntry = nullptr; tp::MemHead* tp::HeapAllocGlobal::mEntry = nullptr;
tp::ualni tp::HeapAllocGlobal::mNumAllocations = 0; tp::ualni tp::HeapAllocGlobal::mNumAllocations = 0;
tp::Mutex tp::HeapAllocGlobal::mMutex; std::mutex tp::HeapAllocGlobal::mMutex;
bool tp::HeapAllocGlobal::mIgnore = true; bool tp::HeapAllocGlobal::mIgnore = true;
// ----------------------- Debug Implementation ---------------------------- // // ----------------------- Debug Implementation ---------------------------- //

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "Module.hpp" #include "Module.hpp"
#include "Multithreading.hpp" #include <mutex>
namespace tp { namespace tp {
@ -10,7 +10,7 @@ namespace tp {
#ifdef MEM_DEBUG #ifdef MEM_DEBUG
static ualni mNumAllocations; static ualni mNumAllocations;
static struct MemHead* mEntry; static struct MemHead* mEntry;
static Mutex mMutex; static std::mutex mMutex;
static bool mIgnore; static bool mIgnore;
#endif #endif

View file

@ -1,4 +1,4 @@
option(MODULES_MEMORY_DEBUG "Debug memory" OFF) option(MODULES_MEMORY_DEBUG "Debug memory" ON)
if (MODULES_MEMORY_DEBUG) if (MODULES_MEMORY_DEBUG)
add_compile_definitions(MEM_DEBUG) add_compile_definitions(MEM_DEBUG)

View file

@ -1,6 +1,5 @@
#include "Player.hpp" #include "Player.hpp"
#include "Buffer.hpp" #include "Buffer.hpp"
#include "Multithreading.hpp"
#include "portaudio.h" #include "portaudio.h"
@ -125,7 +124,7 @@ private:
private: private:
bool mInitializationStatus = false; bool mInitializationStatus = false;
PaStream* mPaStream = nullptr; PaStream* mPaStream = nullptr;
tp::Mutex mMutex; std::mutex mMutex;
const tp::halnf* mBuffer = nullptr; const tp::halnf* mBuffer = nullptr;
const tp::ualni* mPointerMax = nullptr; const tp::ualni* mPointerMax = nullptr;

View file

@ -1,16 +0,0 @@
#pragma once
#include <mutex>
namespace tp {
class Mutex {
std::mutex mMutex;
public:
Mutex() = default;
void lock() { mMutex.lock(); }
void unlock() { mMutex.unlock(); }
};
}