mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
commit
9048bab305
33 changed files with 191 additions and 140 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -62,3 +62,5 @@ rpcs3/git-version.h
|
|||
|
||||
# Ignore other system generated files
|
||||
bin/dev_hdd0/log.txt
|
||||
x64/Debug/emucore.lib
|
||||
x64/Release/emucore.lib
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#define thread_local __declspec(thread)
|
||||
#elif __APPLE__
|
||||
#define thread_local __thread
|
||||
#endif
|
||||
|
||||
#if defined(__GNUG__)
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
|
||||
__forceinline void SM_Sleep()
|
||||
{
|
||||
Sleep(1);
|
||||
if (NamedThreadBase* t = GetCurrentNamedThread())
|
||||
{
|
||||
t->WaitForAnySignal();
|
||||
}
|
||||
else
|
||||
{
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(thread)
|
||||
#elif __APPLE__
|
||||
__thread
|
||||
#else
|
||||
thread_local
|
||||
#endif
|
||||
size_t g_this_thread_id = 0;
|
||||
thread_local size_t g_this_thread_id = 0;
|
||||
|
||||
__forceinline size_t SM_GetCurrentThreadId()
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
default: return res;
|
||||
}
|
||||
|
||||
wait();
|
||||
if (wait) wait();
|
||||
|
||||
if (timeout && counter++ > timeout)
|
||||
{
|
||||
|
@ -133,14 +133,14 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template<typename T, T (get_tid)()>
|
||||
template<typename T, typename Tid, Tid (get_tid)()>
|
||||
class SMutexLockerBase
|
||||
{
|
||||
SMutexBase<T>& sm;
|
||||
T& sm;
|
||||
public:
|
||||
const T tid;
|
||||
const Tid tid;
|
||||
|
||||
__forceinline SMutexLockerBase(SMutexBase<T>& _sm)
|
||||
__forceinline SMutexLockerBase(T& _sm)
|
||||
: sm(_sm)
|
||||
, tid(get_tid())
|
||||
{
|
||||
|
@ -169,9 +169,9 @@ typedef SMutexBase<u32>
|
|||
typedef SMutexBase<be_t<u32>>
|
||||
SMutexBE;
|
||||
|
||||
typedef SMutexLockerBase<size_t, SM_GetCurrentThreadId>
|
||||
typedef SMutexLockerBase<SMutexGeneral, size_t, SM_GetCurrentThreadId>
|
||||
SMutexGeneralLocker;
|
||||
typedef SMutexLockerBase<u32, SM_GetCurrentCPUThreadId>
|
||||
typedef SMutexLockerBase<SMutex, u32, SM_GetCurrentCPUThreadId>
|
||||
SMutexLocker;
|
||||
typedef SMutexLockerBase<be_t<u32>, SM_GetCurrentCPUThreadIdBE>
|
||||
typedef SMutexLockerBase<SMutexBE, be_t<u32>, SM_GetCurrentCPUThreadIdBE>
|
||||
SMutexBELocker;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
template<typename T, u32 SQSize = 666>
|
||||
class SQueue
|
||||
{
|
||||
SMutexGeneral m_mutex;
|
||||
std::mutex m_mutex;
|
||||
u32 m_pos;
|
||||
u32 m_count;
|
||||
T m_data[SQSize];
|
||||
|
@ -24,11 +24,6 @@ public:
|
|||
{
|
||||
while (true)
|
||||
{
|
||||
if (m_mutex.GetOwner() == m_mutex.GetDeadValue())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_count >= SQSize)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
|
@ -40,7 +35,7 @@ public:
|
|||
}
|
||||
|
||||
{
|
||||
SMutexGeneralLocker lock(m_mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (m_count >= SQSize) continue;
|
||||
|
||||
|
@ -55,11 +50,6 @@ public:
|
|||
{
|
||||
while (true)
|
||||
{
|
||||
if (m_mutex.GetOwner() == m_mutex.GetDeadValue())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_count)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
|
@ -71,7 +61,7 @@ public:
|
|||
}
|
||||
|
||||
{
|
||||
SMutexGeneralLocker lock(m_mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (!m_count) continue;
|
||||
|
||||
|
@ -96,7 +86,7 @@ public:
|
|||
|
||||
void Clear()
|
||||
{
|
||||
SMutexGeneralLocker lock(m_mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
|
@ -104,11 +94,6 @@ public:
|
|||
{
|
||||
while (true)
|
||||
{
|
||||
if (m_mutex.GetOwner() == m_mutex.GetDeadValue())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_count)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
|
@ -120,7 +105,7 @@ public:
|
|||
}
|
||||
|
||||
{
|
||||
SMutexGeneralLocker lock(m_mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (m_count) break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,14 +3,8 @@
|
|||
|
||||
#include "Thread.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(thread)
|
||||
#elif __APPLE__
|
||||
__thread
|
||||
#else
|
||||
thread_local
|
||||
#endif
|
||||
NamedThreadBase* g_tls_this_thread = nullptr;
|
||||
thread_local NamedThreadBase* g_tls_this_thread = nullptr;
|
||||
std::atomic<u32> g_thread_count(0);
|
||||
|
||||
NamedThreadBase* GetCurrentNamedThread()
|
||||
{
|
||||
|
@ -56,10 +50,12 @@ void ThreadBase::Start()
|
|||
[this]()
|
||||
{
|
||||
g_tls_this_thread = this;
|
||||
g_thread_count++;
|
||||
|
||||
Task();
|
||||
|
||||
m_alive = false;
|
||||
g_thread_count--;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -130,6 +126,7 @@ void thread::start(std::function<void()> func)
|
|||
{
|
||||
NamedThreadBase info(name);
|
||||
g_tls_this_thread = &info;
|
||||
g_thread_count++;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -140,6 +137,8 @@ void thread::start(std::function<void()> func)
|
|||
ConLog.Error("Crash :(");
|
||||
//std::terminate();
|
||||
}
|
||||
|
||||
g_thread_count--;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ class NamedThreadBase
|
|||
{
|
||||
std::string m_name;
|
||||
|
||||
std::condition_variable m_signal_cv;
|
||||
std::mutex m_signal_mtx;
|
||||
|
||||
public:
|
||||
NamedThreadBase(const std::string& name) : m_name(name)
|
||||
{
|
||||
|
@ -24,6 +27,17 @@ public:
|
|||
|
||||
virtual std::string GetThreadName() const;
|
||||
virtual void SetThreadName(const std::string& name);
|
||||
|
||||
void WaitForAnySignal() // wait 1 ms for something
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_signal_mtx);
|
||||
m_signal_cv.wait_for(lock, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
void Notify() // wake up waiting thread or nothing
|
||||
{
|
||||
m_signal_cv.notify_one();
|
||||
}
|
||||
};
|
||||
|
||||
NamedThreadBase* GetCurrentNamedThread();
|
||||
|
|
2
asmjit
2
asmjit
|
@ -1 +1 @@
|
|||
Subproject commit b76922fde96232030be302b3bdd9673e9bcec568
|
||||
Subproject commit a66efd54609aab7dd98e34c069937f34aa7c8f95
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
|
@ -26,12 +26,10 @@
|
|||
<ClCompile Include="..\asmjit\src\asmjit\base\context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cputicks.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\defs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\error.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\func.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\globals.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\logger.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\memorymanager.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\podvector.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\runtime.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\string.cpp" />
|
||||
|
@ -42,8 +40,11 @@
|
|||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86compiler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86defs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86func.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86inst.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86regs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86util.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\asmjit\src\asmjit\base\constpool.h" />
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86assembler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86compiler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86defs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86func.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\contrib\winremoteruntime.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\assembler.cpp" />
|
||||
|
@ -14,18 +13,20 @@
|
|||
<ClCompile Include="..\asmjit\src\asmjit\base\context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cputicks.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\defs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\error.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\func.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\globals.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\logger.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\memorymanager.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\podvector.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\runtime.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\string.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\vmem.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\zone.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\constpool.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86inst.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86regs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86util.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\asmjit\src\asmjit\base\constpool.h" />
|
||||
|
|
|
@ -3,9 +3,14 @@
|
|||
#include "Emu/CPU/CPUDecoder.h"
|
||||
#include "Utilities/SMutex.h"
|
||||
|
||||
typedef SMutexBase<u32, 0, 0xffffffff, /* busy wait: specify nullptr */ SM_Sleep> SMutexR;
|
||||
typedef SMutexLockerBase<SMutexR, u32, SM_GetCurrentCPUThreadId> SMutexLockerR;
|
||||
|
||||
struct reservation_struct
|
||||
{
|
||||
SMutex mutex; // mutex for updating reservation_owner and data
|
||||
SMutexR mutex; // mutex for updating reservation_owner and data
|
||||
// std::mutex doesn't work because it probably wakes up waiting threads in the most unwanted order
|
||||
// and doesn't give a chance to finish some work before losing the reservation
|
||||
u32 owner; // id of thread that got reservation
|
||||
u32 addr;
|
||||
u32 size;
|
||||
|
|
|
@ -2367,7 +2367,7 @@ private:
|
|||
{
|
||||
const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb];
|
||||
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
SMutexLockerR lock(reservation.mutex);
|
||||
reservation.owner = lock.tid;
|
||||
reservation.addr = addr;
|
||||
reservation.size = 4;
|
||||
|
@ -2522,7 +2522,7 @@ private:
|
|||
{
|
||||
const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb];
|
||||
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
SMutexLockerR lock(reservation.mutex);
|
||||
reservation.owner = lock.tid;
|
||||
reservation.addr = addr;
|
||||
reservation.size = 8;
|
||||
|
@ -2641,7 +2641,7 @@ private:
|
|||
{
|
||||
const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb];
|
||||
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
SMutexLockerR lock(reservation.mutex);
|
||||
if (lock.tid == reservation.owner && reservation.addr == addr && reservation.size == 4)
|
||||
{
|
||||
// Memory.Write32(addr, CPU.GPR[rs]);
|
||||
|
@ -2702,7 +2702,7 @@ private:
|
|||
{
|
||||
const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb];
|
||||
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
SMutexLockerR lock(reservation.mutex);
|
||||
if (lock.tid == reservation.owner && reservation.addr == addr && reservation.size == 8)
|
||||
{
|
||||
// Memory.Write64(addr, CPU.GPR[rs]);
|
||||
|
|
|
@ -1931,7 +1931,7 @@ private:
|
|||
c.mov(*addr, cpu_dword(GPR[ra]._i32[3]));
|
||||
c.cmp(*addr, cpu_dword(GPR[rb]._i32[3]));
|
||||
c.mov(*addr, 0);
|
||||
c.setg(*addr);
|
||||
c.setg(addr->r8());
|
||||
c.neg(*addr);
|
||||
c.mov(*pos_var, (CPU.PC >> 2) + 1);
|
||||
c.xor_(*pos_var, *addr);
|
||||
|
@ -2311,7 +2311,7 @@ private:
|
|||
c.mov(*addr, cpu_dword(GPR[ra]._u32[3]));
|
||||
c.cmp(*addr, cpu_dword(GPR[rb]._u32[3]));
|
||||
c.mov(*addr, 0);
|
||||
c.seta(*addr);
|
||||
c.seta(addr->r8());
|
||||
c.neg(*addr);
|
||||
c.mov(*pos_var, (CPU.PC >> 2) + 1);
|
||||
c.xor_(*pos_var, *addr);
|
||||
|
@ -2729,7 +2729,7 @@ private:
|
|||
c.mov(*addr, cpu_dword(GPR[ra]._i32[3]));
|
||||
c.cmp(*addr, cpu_dword(GPR[rb]._i32[3]));
|
||||
c.mov(*addr, 0);
|
||||
c.sete(*addr);
|
||||
c.sete(addr->r8());
|
||||
c.neg(*addr);
|
||||
c.mov(*pos_var, (CPU.PC >> 2) + 1);
|
||||
c.xor_(*pos_var, *addr);
|
||||
|
@ -3391,7 +3391,7 @@ private:
|
|||
c.mov(*addr, cpu_dword(GPR[ra]._i32[3]));
|
||||
c.cmp(*addr, i10);
|
||||
c.mov(*addr, 0);
|
||||
c.setg(*addr);
|
||||
c.setg(addr->r8());
|
||||
c.neg(*addr);
|
||||
c.mov(*pos_var, (CPU.PC >> 2) + 1);
|
||||
c.xor_(*pos_var, *addr);
|
||||
|
@ -3457,7 +3457,7 @@ private:
|
|||
c.mov(*addr, cpu_dword(GPR[ra]._u32[3]));
|
||||
c.cmp(*addr, i10);
|
||||
c.mov(*addr, 0);
|
||||
c.seta(*addr);
|
||||
c.seta(addr->r8());
|
||||
c.neg(*addr);
|
||||
c.mov(*pos_var, (CPU.PC >> 2) + 1);
|
||||
c.xor_(*pos_var, *addr);
|
||||
|
@ -3508,7 +3508,7 @@ private:
|
|||
c.mov(*addr, cpu_dword(GPR[ra]._u32[3]));
|
||||
c.cmp(*addr, i10);
|
||||
c.mov(*addr, 0);
|
||||
c.sete(*addr);
|
||||
c.sete(addr->r8());
|
||||
c.neg(*addr);
|
||||
c.mov(*pos_var, (CPU.PC >> 2) + 1);
|
||||
c.xor_(*pos_var, *addr);
|
||||
|
|
|
@ -115,7 +115,7 @@ void SPUThread::DoClose()
|
|||
for (u32 i = 0; i < 64; i++)
|
||||
{
|
||||
EventPort& port = SPUPs[i];
|
||||
SMutexLocker lock(port.mutex);
|
||||
std::lock_guard<std::mutex> lock(port.m_mutex);
|
||||
if (port.eq)
|
||||
{
|
||||
port.eq->ports.remove(&port);
|
||||
|
|
|
@ -733,7 +733,7 @@ public:
|
|||
|
||||
if (op == MFC_GETLLAR_CMD) // get reservation
|
||||
{
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
SMutexLockerR lock(reservation.mutex);
|
||||
reservation.owner = lock.tid;
|
||||
reservation.addr = ea;
|
||||
reservation.size = 128;
|
||||
|
@ -746,7 +746,7 @@ public:
|
|||
}
|
||||
else if (op == MFC_PUTLLC_CMD) // store conditional
|
||||
{
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
SMutexLockerR lock(reservation.mutex);
|
||||
if (reservation.owner == lock.tid) // succeeded
|
||||
{
|
||||
if (reservation.addr == ea && reservation.size == 128)
|
||||
|
@ -827,7 +827,7 @@ public:
|
|||
}
|
||||
else // store unconditional
|
||||
{
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
SMutexLockerR lock(reservation.mutex);
|
||||
ProcessCmd(MFC_PUT_CMD, tag, lsa, ea, 128);
|
||||
if (op == MFC_PUTLLUC_CMD)
|
||||
{
|
||||
|
@ -929,7 +929,7 @@ public:
|
|||
|
||||
EventPort& port = SPUPs[spup];
|
||||
|
||||
SMutexLocker lock(port.mutex);
|
||||
std::lock_guard<std::mutex> lock(port.m_mutex);
|
||||
|
||||
if (!port.eq)
|
||||
{
|
||||
|
@ -937,7 +937,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
if (!port.eq->events.push(SYS_SPU_THREAD_EVENT_USER_KEY, lock.tid, ((u64)code << 32) | (v & 0x00ffffff), data))
|
||||
if (!port.eq->events.push(SYS_SPU_THREAD_EVENT_USER_KEY, GetCurrentCPUThread()->GetId(), ((u64)code << 32) | (v & 0x00ffffff), data))
|
||||
{
|
||||
SPU.In_MBox.PushUncond(CELL_EBUSY);
|
||||
return;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
void EventManager::Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EventManager::Clear()
|
||||
|
@ -17,7 +16,7 @@ void EventManager::Clear()
|
|||
bool EventManager::CheckKey(u64 key)
|
||||
{
|
||||
if (!key) return true;
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
return key_map.find(key) != key_map.end();
|
||||
}
|
||||
|
@ -25,7 +24,7 @@ bool EventManager::CheckKey(u64 key)
|
|||
bool EventManager::RegisterKey(EventQueue* data, u64 key)
|
||||
{
|
||||
if (!key) return true;
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
if (key_map.find(key) != key_map.end()) return false;
|
||||
|
||||
|
@ -43,7 +42,7 @@ bool EventManager::GetEventQueue(u64 key, EventQueue*& data)
|
|||
{
|
||||
data = nullptr;
|
||||
if (!key) return false;
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
auto f = key_map.find(key);
|
||||
if (f != key_map.end())
|
||||
|
@ -57,7 +56,7 @@ bool EventManager::GetEventQueue(u64 key, EventQueue*& data)
|
|||
bool EventManager::UnregisterKey(u64 key)
|
||||
{
|
||||
if (!key) return false;
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
auto f = key_map.find(key);
|
||||
if (f != key_map.end())
|
||||
|
@ -71,7 +70,7 @@ bool EventManager::UnregisterKey(u64 key)
|
|||
bool EventManager::SendEvent(u64 key, u64 source, u64 d1, u64 d2, u64 d3)
|
||||
{
|
||||
if (!key) return false;
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
auto f = key_map.find(key);
|
||||
if (f == key_map.end())
|
||||
|
|
|
@ -536,7 +536,14 @@ void GLShaderProgram::Delete()
|
|||
|
||||
if (m_id)
|
||||
{
|
||||
glDeleteShader(m_id);
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
ConLog.Warning("GLShaderProgram::Delete(): glDeleteShader(%d) avoided", m_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDeleteShader(m_id);
|
||||
}
|
||||
m_id = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -665,7 +665,14 @@ void GLVertexProgram::Delete()
|
|||
|
||||
if(id)
|
||||
{
|
||||
glDeleteShader(id);
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
ConLog.Warning("GLVertexProgram::Delete(): glDeleteShader(%d) avoided", id);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDeleteShader(id);
|
||||
}
|
||||
id = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1869,6 +1869,11 @@ void RSXThread::Task()
|
|||
|
||||
while(!TestDestroy())
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
ConLog.Warning("RSX thread aborted");
|
||||
return;
|
||||
}
|
||||
rCriticalSectionLocker lock(m_cs_main);
|
||||
|
||||
inc=1;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "cellPamf.h"
|
||||
|
||||
extern SMutexGeneral g_mutex_avcodec_open2;
|
||||
extern std::mutex g_mutex_avcodec_open2;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ u32 adecOpen(AudioDecoder* data)
|
|||
AVDictionary* opts = nullptr;
|
||||
av_dict_set(&opts, "refcounted_frames", "1", 0);
|
||||
{
|
||||
SMutexGeneralLocker lock(g_mutex_avcodec_open2);
|
||||
std::lock_guard<std::mutex> lock(g_mutex_avcodec_open2);
|
||||
// not multithread-safe
|
||||
err = avcodec_open2(adec.ctx, codec, &opts);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//Module cellAudio(0x0011, cellAudio_init);
|
||||
extern Module *cellAudio = nullptr;
|
||||
|
||||
static SMutexGeneral audioMutex;
|
||||
static std::mutex audioMutex;
|
||||
|
||||
AudioConfig m_config;
|
||||
|
||||
|
@ -394,7 +394,7 @@ int cellAudioInit()
|
|||
|
||||
// send aftermix event (normal audio event)
|
||||
{
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
std::lock_guard<std::mutex> lock(audioMutex);
|
||||
// update indexes:
|
||||
for (u32 i = 0; i < m_config.AUDIO_PORT_COUNT; i++)
|
||||
{
|
||||
|
@ -694,7 +694,7 @@ int cellAudioGetPortTimestamp(u32 portNum, u64 tag, mem64_t stamp)
|
|||
|
||||
AudioPortConfig& port = m_config.m_ports[portNum];
|
||||
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
std::lock_guard<std::mutex> lock(audioMutex);
|
||||
|
||||
stamp = m_config.start_time + (port.counter + (tag - port.tag)) * 256000000 / 48000;
|
||||
|
||||
|
@ -728,7 +728,7 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag)
|
|||
return CELL_AUDIO_ERROR_PARAM;
|
||||
}
|
||||
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
std::lock_guard<std::mutex> lock(audioMutex);
|
||||
|
||||
u64 tag_base = port.tag;
|
||||
if (tag_base % port.block > blockNo)
|
||||
|
@ -756,7 +756,7 @@ int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key)
|
|||
{
|
||||
cellAudio->Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.GetAddr(), key.GetAddr());
|
||||
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
std::lock_guard<std::mutex> lock(audioMutex);
|
||||
|
||||
u64 event_key = 0;
|
||||
while (Emu.GetEventManager().CheckKey((event_key << 48) | 0x80004d494f323221))
|
||||
|
@ -790,7 +790,7 @@ int cellAudioSetNotifyEventQueue(u64 key)
|
|||
{
|
||||
cellAudio->Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key);
|
||||
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
std::lock_guard<std::mutex> lock(audioMutex);
|
||||
|
||||
for (u32 i = 0; i < m_config.m_keys.size(); i++) // check for duplicates
|
||||
{
|
||||
|
@ -822,7 +822,7 @@ int cellAudioRemoveNotifyEventQueue(u64 key)
|
|||
{
|
||||
cellAudio->Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key);
|
||||
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
std::lock_guard<std::mutex> lock(audioMutex);
|
||||
|
||||
bool found = false;
|
||||
for (u32 i = 0; i < m_config.m_keys.size(); i++)
|
||||
|
|
|
@ -481,7 +481,7 @@ public:
|
|||
|
||||
class ElementaryStream
|
||||
{
|
||||
SMutex mutex;
|
||||
std::mutex m_mutex;
|
||||
|
||||
SQueue<u32> entries; // AU starting addresses
|
||||
u32 put_count; // number of AU written
|
||||
|
@ -566,19 +566,19 @@ public:
|
|||
|
||||
bool hasunseen()
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return peek_count < put_count;
|
||||
}
|
||||
|
||||
bool hasdata()
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return size;
|
||||
}
|
||||
|
||||
bool isfull()
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return is_full();
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,7 @@ public:
|
|||
{
|
||||
u32 addr;
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
//if (fidMajor != 0xbd) ConLog.Write(">>> es::finish(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size);
|
||||
|
||||
addr = put;
|
||||
|
@ -621,7 +621,7 @@ public:
|
|||
|
||||
void push(DemuxerStream& stream, u32 sz, PesHeader& pes)
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (is_full())
|
||||
{
|
||||
|
@ -673,7 +673,7 @@ public:
|
|||
|
||||
bool release()
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
//if (fidMajor != 0xbd) ConLog.Write(">>> es::release(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size);
|
||||
if (released >= put_count)
|
||||
{
|
||||
|
@ -720,7 +720,7 @@ public:
|
|||
|
||||
bool peek(u32& out_data, bool no_ex, u32& out_spec, bool update_index)
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
//if (fidMajor != 0xbd) ConLog.Write(">>> es::peek(%sAu%s): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", wxString(update_index ? "Get" : "Peek").wx_str(),
|
||||
//wxString(no_ex ? "" : "Ex").wx_str(), peek, first, put, size);
|
||||
if (peek_count >= put_count) return false;
|
||||
|
@ -767,7 +767,7 @@ public:
|
|||
|
||||
void reset()
|
||||
{
|
||||
SMutexLocker lock(mutex);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
//first = 0;
|
||||
//peek = 0;
|
||||
put = memAddr;
|
||||
|
|
|
@ -471,7 +471,7 @@ int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
|
|||
return CELL_GCM_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); // could stall on exit
|
||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); // could freeze on exit
|
||||
|
||||
u32 current = ctxt->current;
|
||||
u32 end = ctxt->end;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "cellPamf.h"
|
||||
|
||||
SMutexGeneral g_mutex_avcodec_open2;
|
||||
std::mutex g_mutex_avcodec_open2;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ u32 vdecOpen(VideoDecoder* data)
|
|||
AVDictionary* opts = nullptr;
|
||||
av_dict_set(&opts, "refcounted_frames", "1", 0);
|
||||
{
|
||||
SMutexGeneralLocker lock(g_mutex_avcodec_open2);
|
||||
std::lock_guard<std::mutex> lock(g_mutex_avcodec_open2);
|
||||
// not multithread-safe
|
||||
err = avcodec_open2(vdec.ctx, codec, &opts);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ CellSurMixerConfig surMixer;
|
|||
#define SUR_PORT (7)
|
||||
u32 surMixerCb = 0;
|
||||
u32 surMixerCbArg = 0;
|
||||
SMutex mixer_mutex;
|
||||
std::mutex mixer_mutex;
|
||||
float mixdata[8*256];
|
||||
u64 mixcount = 0;
|
||||
|
||||
|
@ -53,7 +53,7 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
SMutexLocker lock(mixer_mutex);
|
||||
std::lock_guard<std::mutex> lock(mixer_mutex);
|
||||
|
||||
if (type == CELL_SURMIXER_CHSTRIP_TYPE1A)
|
||||
{
|
||||
|
@ -316,7 +316,7 @@ int cellSurMixerSurBusAddData(u32 busNo, u32 offset, u32 addr, u32 samples)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
SMutexLocker lock(mixer_mutex);
|
||||
std::lock_guard<std::mutex> lock(mixer_mutex);
|
||||
|
||||
for (u32 i = 0; i < samples; i++)
|
||||
{
|
||||
|
|
|
@ -280,20 +280,18 @@ int sys_event_port_destroy(u32 eport_id)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
if (eport->mutex.trylock(tid) != SMR_OK)
|
||||
if (!eport->m_mutex.try_lock())
|
||||
{
|
||||
return CELL_EISCONN;
|
||||
}
|
||||
|
||||
if (eport->eq)
|
||||
{
|
||||
eport->mutex.unlock(tid);
|
||||
eport->m_mutex.unlock();
|
||||
return CELL_EISCONN;
|
||||
}
|
||||
|
||||
eport->mutex.unlock(tid, ~0);
|
||||
eport->m_mutex.unlock();
|
||||
Emu.GetIdManager().RemoveID(eport_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -308,16 +306,14 @@ int sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
if (eport->mutex.trylock(tid) != SMR_OK)
|
||||
if (!eport->m_mutex.try_lock())
|
||||
{
|
||||
return CELL_EISCONN;
|
||||
}
|
||||
|
||||
if (eport->eq)
|
||||
{
|
||||
eport->mutex.unlock(tid);
|
||||
eport->m_mutex.unlock();
|
||||
return CELL_EISCONN;
|
||||
}
|
||||
|
||||
|
@ -325,7 +321,7 @@ int sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
|||
if (!Emu.GetIdManager().GetIDData(equeue_id, equeue))
|
||||
{
|
||||
sys_event.Error("sys_event_port_connect_local: event_queue(%d) not found!", equeue_id);
|
||||
eport->mutex.unlock(tid);
|
||||
eport->m_mutex.unlock();
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
else
|
||||
|
@ -334,7 +330,7 @@ int sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
|||
}
|
||||
|
||||
eport->eq = equeue;
|
||||
eport->mutex.unlock(tid);
|
||||
eport->m_mutex.unlock();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -353,16 +349,14 @@ int sys_event_port_disconnect(u32 eport_id)
|
|||
return CELL_ENOTCONN;
|
||||
}
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
if (eport->mutex.trylock(tid) != SMR_OK)
|
||||
if (!eport->m_mutex.try_lock())
|
||||
{
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
eport->eq->ports.remove(eport);
|
||||
eport->eq = nullptr;
|
||||
eport->mutex.unlock(tid);
|
||||
eport->m_mutex.unlock();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -377,7 +371,7 @@ int sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
SMutexLocker lock(eport->mutex);
|
||||
std::lock_guard<std::mutex> lock(eport->m_mutex);
|
||||
|
||||
EventQueue* eq = eport->eq;
|
||||
if (!eq)
|
||||
|
|
|
@ -13,7 +13,7 @@ extern gcmInfo gcm_info;
|
|||
|
||||
int cellGcmCallback(u32 context_addr, u32 count)
|
||||
{
|
||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); // could stall on exit
|
||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); // could freeze on exit
|
||||
|
||||
CellGcmContextData& ctx = (CellGcmContextData&)Memory[context_addr];
|
||||
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
|
||||
|
|
|
@ -83,7 +83,7 @@ void sys_ppu_thread_get_join_state(u32 isjoinable_addr)
|
|||
|
||||
int sys_ppu_thread_set_priority(u32 thread_id, int prio)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_set_priority(thread_id=%d, prio=%d)", thread_id, prio);
|
||||
sysPrxForUser->Log("sys_ppu_thread_set_priority(thread_id=%d, prio=%d)", thread_id, prio);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
|
|
|
@ -604,7 +604,7 @@ int sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
|||
|
||||
EventPort& port = spu.SPUPs[spup];
|
||||
|
||||
SMutexLocker lock(port.mutex);
|
||||
std::lock_guard<std::mutex> lock(port.m_mutex);
|
||||
|
||||
if (port.eq)
|
||||
{
|
||||
|
@ -645,7 +645,7 @@ int sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
|||
|
||||
EventPort& port = spu.SPUPs[spup];
|
||||
|
||||
SMutexLocker lock(port.mutex);
|
||||
std::lock_guard<std::mutex> lock(port.m_mutex);
|
||||
|
||||
if (!port.eq)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ using namespace PPU_instr;
|
|||
|
||||
static const std::string& BreakPointsDBName = "BreakPoints.dat";
|
||||
static const u16 bpdb_version = 0x1000;
|
||||
extern std::atomic<u32> g_thread_count;
|
||||
|
||||
ModuleInitializer::ModuleInitializer()
|
||||
{
|
||||
|
@ -345,8 +346,10 @@ void Emulator::Pause()
|
|||
//ConLog.Write("pause...");
|
||||
SendDbgCommand(DID_PAUSE_EMU);
|
||||
|
||||
m_status = Paused;
|
||||
SendDbgCommand(DID_PAUSED_EMU);
|
||||
if (InterlockedCompareExchange((volatile unsigned long*)&m_status, Paused, Running) == Running)
|
||||
{
|
||||
SendDbgCommand(DID_PAUSED_EMU);
|
||||
}
|
||||
}
|
||||
|
||||
void Emulator::Resume()
|
||||
|
@ -370,8 +373,27 @@ void Emulator::Stop()
|
|||
SendDbgCommand(DID_STOP_EMU);
|
||||
m_status = Stopped;
|
||||
|
||||
u32 uncounted = 0 + (u32)(bool)m_dbg_console;
|
||||
u32 counter = 0;
|
||||
while (true)
|
||||
{
|
||||
if (g_thread_count <= uncounted)
|
||||
{
|
||||
ConLog.Write("All threads stopped...");
|
||||
break;
|
||||
}
|
||||
Sleep(1);
|
||||
if (counter++ > 3000)
|
||||
{
|
||||
ConLog.Error("%d threads not stopped (timeout)", (u32)(g_thread_count - uncounted));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_rsx_callback = 0;
|
||||
|
||||
// TODO: check finalization order
|
||||
|
||||
SavePoints(BreakPointsDBName);
|
||||
m_break_points.clear();
|
||||
m_marked_points.clear();
|
||||
|
@ -388,7 +410,7 @@ void Emulator::Stop()
|
|||
GetKeyboardManager().Close();
|
||||
GetMouseManager().Close();
|
||||
GetCallbackManager().Clear();
|
||||
//not all modules unload cleanly, so we're not unloading them for now
|
||||
// TODO: not all modules unload cleanly, so we're not unloading them for now
|
||||
//GetModuleManager().UnloadModules();
|
||||
|
||||
CurGameInfo.Reset();
|
||||
|
|
|
@ -58,7 +58,7 @@ struct EventPort
|
|||
{
|
||||
u64 name; // generated or user-specified code that is passed to sys_event_data struct
|
||||
EventQueue* eq; // event queue this port has been connected to
|
||||
SMutex mutex; // may be locked until the event sending is finished
|
||||
std::mutex m_mutex; // may be locked until the event sending is finished
|
||||
|
||||
EventPort(u64 name = 0)
|
||||
: eq(nullptr)
|
||||
|
@ -70,7 +70,7 @@ struct EventPort
|
|||
class EventRingBuffer
|
||||
{
|
||||
std::vector<sys_event_data> data;
|
||||
SMutex m_lock;
|
||||
std::mutex m_mutex;
|
||||
u32 buf_pos;
|
||||
u32 buf_count;
|
||||
|
||||
|
@ -87,14 +87,14 @@ public:
|
|||
|
||||
void clear()
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
buf_count = 0;
|
||||
buf_pos = 0;
|
||||
}
|
||||
|
||||
bool push(u64 name, u64 d1, u64 d2, u64 d3)
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (buf_count >= size) return false;
|
||||
|
||||
sys_event_data& ref = data[(buf_pos + buf_count++) % size];
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
bool pop(sys_event_data& ref)
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (!buf_count) return false;
|
||||
|
||||
sys_event_data& from = data[buf_pos];
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
|
||||
u32 pop_all(sys_event_data* ptr, u32 max)
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
u32 res = 0;
|
||||
while (buf_count && max)
|
||||
|
@ -152,16 +152,16 @@ public:
|
|||
class EventPortList
|
||||
{
|
||||
std::vector<EventPort*> data;
|
||||
SMutex m_lock;
|
||||
std::mutex m_mutex;
|
||||
|
||||
public:
|
||||
|
||||
void clear()
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
SMutexLocker lock2(data[i]->mutex);
|
||||
std::lock_guard<std::mutex> lock2(data[i]->m_mutex);
|
||||
data[i]->eq = nullptr; // force all ports to disconnect
|
||||
}
|
||||
data.clear();
|
||||
|
@ -169,13 +169,13 @@ public:
|
|||
|
||||
void add(EventPort* port)
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
data.push_back(port);
|
||||
}
|
||||
|
||||
void remove(EventPort* port)
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
if (data[i] == port)
|
||||
|
@ -215,7 +215,7 @@ struct EventQueue
|
|||
|
||||
class EventManager
|
||||
{
|
||||
SMutex m_lock;
|
||||
std::mutex m_lock;
|
||||
std::unordered_map<u64, EventQueue*> key_map;
|
||||
|
||||
public:
|
||||
|
|
|
@ -267,6 +267,7 @@
|
|||
<ClInclude Include="Emu\CPU\CPUThread.h" />
|
||||
<ClInclude Include="Emu\CPU\CPUThreadManager.h" />
|
||||
<ClInclude Include="Emu\DbgCommand.h" />
|
||||
<ClInclude Include="Emu\event.h" />
|
||||
<ClInclude Include="Emu\FS\VFS.h" />
|
||||
<ClInclude Include="Emu\FS\vfsDevice.h" />
|
||||
<ClInclude Include="Emu\FS\vfsDeviceLocalFile.h" />
|
||||
|
|
|
@ -1039,5 +1039,8 @@
|
|||
<ClInclude Include="Emu\Io\XInput\XInputPadHandler.h">
|
||||
<Filter>Emu\Io\XInput</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\event.h">
|
||||
<Filter>Emu\SysCalls</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Add table
Reference in a new issue