1
0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@369 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-03-05 17:15:56 +00:00
parent e4043be593
commit 0df305e226

View File

@ -353,31 +353,36 @@ bool cServer::Tick(float a_Dt)
cRoot::Get()->TickWorlds( a_Dt ); // TODO - Maybe give all worlds their own thread?
cClientHandleList RemoveClients;
{
cCSLock Lock(m_CSClients);
for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end();)
{
if ((*itr)->IsDestroyed())
{
cClientHandle* RemoveMe = *itr;
RemoveClients.push_back(*itr); // Remove the client later, when CS is not held, to avoid deadlock ( http://forum.mc-server.org/showthread.php?tid=374 )
itr = m_Clients.erase(itr);
delete RemoveMe;
continue;
}
(*itr)->Tick(a_Dt);
++itr;
}
} // for itr - m_Clients[]
}
for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr)
{
delete *itr;
} // for itr - RemoveClients[]
cRoot::Get()->GetPluginManager()->Tick( a_Dt );
if( !m_bRestarting )
{
return true;
}
else
{
m_bRestarting = false;
m_pState->RestartEvent.Set();
LOG("<<<<>>>>SIGNALLED SEMAPHORE");
return false;
}
}