Skip to content

Commit

Permalink
lock_gaurds in spaaaaaaaaaccccce.
Browse files Browse the repository at this point in the history
  • Loading branch information
Parlane committed Feb 1, 2013
1 parent f43567e commit 6b8bb1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
Expand Up @@ -697,7 +697,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 CommandAddress)
u32 s = Memory::Read_U32(BufferIn);
_tSocket * sock = NULL;
{
std::unique_lock<std::mutex> lk(socketMapMutex);
std::lock_guard<std::mutex> lk(socketMapMutex);
if(socketMap.find(s) != socketMap.end())
sock = socketMap[s];
}
Expand Down Expand Up @@ -729,7 +729,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 CommandAddress)

if (ReturnValue > 0)
{
std::unique_lock<std::mutex> lk(socketMapMutex);
std::lock_guard<std::mutex> lk(socketMapMutex);
_tSocket* sock = new _tSocket();
socketMap[s] = sock;
sock->thread = new std::thread([this, s]{this->socketProcessor(s);});
Expand Down Expand Up @@ -773,7 +773,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 CommandAddress)

_tSocket * sock = NULL;
{
std::unique_lock<std::mutex> lk(socketMapMutex);
std::lock_guard<std::mutex> lk(socketMapMutex);
if(socketMap.find(s) != socketMap.end())
sock = socketMap[s];
if(sock)
Expand Down Expand Up @@ -1344,7 +1344,7 @@ void CWII_IPC_HLE_Device_net_ip_top::socketProcessor(u32 socket)
ERROR_LOG(WII_IPC_NET, "Socket %d has started a thread.... oh dear.", socket);
_tSocket* sock = NULL;
{
std::unique_lock<std::mutex> lk(socketMapMutex);
std::lock_guard<std::mutex> lk(socketMapMutex);
if(socketMap.find(socket) == socketMap.end())
{
ERROR_LOG(WII_IPC_NET, "Socket %d could not be found in the socket map.", socket);
Expand Down Expand Up @@ -1780,7 +1780,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)

_tSocket * sock = NULL;
{
std::unique_lock<std::mutex> lk(socketMapMutex);
std::lock_guard<std::mutex> lk(socketMapMutex);
if(socketMap.find(s) != socketMap.end())
sock = socketMap[s];
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h
Expand Up @@ -583,7 +583,7 @@ class _tSocket

bool getCommand(u32& commandAddress)
{
std::unique_lock<std::mutex> lk(m_mutex);
std::lock_guard<std::mutex> lk(m_mutex);
if (commands.empty())
return false;
commandAddress = commands.front();
Expand All @@ -593,7 +593,7 @@ class _tSocket

void addCommand(u32 commandAddress)
{
std::unique_lock<std::mutex> lk(m_mutex);
std::lock_guard<std::mutex> lk(m_mutex);
commands.push(commandAddress);
event.Set();
}
Expand Down

0 comments on commit 6b8bb1b

Please sign in to comment.