mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-05 15:48:51 +00:00
Thread safe enq_reply.
This commit is contained in:
parent
d3f199273b
commit
8fdc8af1cb
1 changed files with 19 additions and 6 deletions
|
@ -83,6 +83,7 @@ IWII_IPC_HLE_Device* es_handles[ES_MAX_COUNT];
|
||||||
typedef std::deque<u32> ipc_msg_queue;
|
typedef std::deque<u32> ipc_msg_queue;
|
||||||
static ipc_msg_queue request_queue; // ppc -> arm
|
static ipc_msg_queue request_queue; // ppc -> arm
|
||||||
static ipc_msg_queue reply_queue; // arm -> ppc
|
static ipc_msg_queue reply_queue; // arm -> ppc
|
||||||
|
static std::mutex s_reply_queue;
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
|
@ -159,7 +160,12 @@ void Reset(bool _bHard)
|
||||||
g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end());
|
g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end());
|
||||||
}
|
}
|
||||||
request_queue.clear();
|
request_queue.clear();
|
||||||
|
|
||||||
|
// lock due to using reply_queue
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||||
reply_queue.clear();
|
reply_queue.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
|
@ -241,6 +247,8 @@ IWII_IPC_HLE_Device* CreateFileIO(u32 _DeviceID, const std::string& _rDeviceName
|
||||||
|
|
||||||
void DoState(PointerWrap &p)
|
void DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||||
|
|
||||||
p.Do(request_queue);
|
p.Do(request_queue);
|
||||||
p.Do(reply_queue);
|
p.Do(reply_queue);
|
||||||
|
|
||||||
|
@ -536,6 +544,7 @@ void EnqRequest(u32 _Address)
|
||||||
// Called when IOS module has some reply
|
// Called when IOS module has some reply
|
||||||
void EnqReply(u32 _Address)
|
void EnqReply(u32 _Address)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||||
reply_queue.push_back(_Address);
|
reply_queue.push_back(_Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,12 +570,16 @@ void Update()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lock due to using reply_queue
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||||
if (reply_queue.size())
|
if (reply_queue.size())
|
||||||
{
|
{
|
||||||
WII_IPCInterface::GenerateReply(reply_queue.front());
|
WII_IPCInterface::GenerateReply(reply_queue.front());
|
||||||
INFO_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", reply_queue.front());
|
INFO_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", reply_queue.front());
|
||||||
reply_queue.pop_front();
|
reply_queue.pop_front();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDevices()
|
void UpdateDevices()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue