mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 15:31:17 +01:00
Thread safe enq_reply.
This commit is contained in:
parent
d3f199273b
commit
8fdc8af1cb
@ -83,6 +83,7 @@ IWII_IPC_HLE_Device* es_handles[ES_MAX_COUNT];
|
||||
typedef std::deque<u32> ipc_msg_queue;
|
||||
static ipc_msg_queue request_queue; // ppc -> arm
|
||||
static ipc_msg_queue reply_queue; // arm -> ppc
|
||||
static std::mutex s_reply_queue;
|
||||
|
||||
void Init()
|
||||
{
|
||||
@ -159,7 +160,12 @@ void Reset(bool _bHard)
|
||||
g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end());
|
||||
}
|
||||
request_queue.clear();
|
||||
reply_queue.clear();
|
||||
|
||||
// lock due to using reply_queue
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
reply_queue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
@ -241,6 +247,8 @@ IWII_IPC_HLE_Device* CreateFileIO(u32 _DeviceID, const std::string& _rDeviceName
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
|
||||
p.Do(request_queue);
|
||||
p.Do(reply_queue);
|
||||
|
||||
@ -536,6 +544,7 @@ void EnqRequest(u32 _Address)
|
||||
// Called when IOS module has some reply
|
||||
void EnqReply(u32 _Address)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
reply_queue.push_back(_Address);
|
||||
}
|
||||
|
||||
@ -560,12 +569,16 @@ void Update()
|
||||
Dolphin_Debugger::PrintCallstack(LogTypes::WII_IPC_HLE, LogTypes::LDEBUG);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (reply_queue.size())
|
||||
|
||||
// lock due to using reply_queue
|
||||
{
|
||||
WII_IPCInterface::GenerateReply(reply_queue.front());
|
||||
INFO_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", reply_queue.front());
|
||||
reply_queue.pop_front();
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
if (reply_queue.size())
|
||||
{
|
||||
WII_IPCInterface::GenerateReply(reply_queue.front());
|
||||
INFO_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", reply_queue.front());
|
||||
reply_queue.pop_front();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user