mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-30 17:58:16 +00:00
[Process Management] Change all executables to use the default event loop run (#2471)
* Loginserver change to event loop run. * eqlaunch, loginserver, queryserv, world
This commit is contained in:
+16
-8
@@ -105,11 +105,17 @@ int main(int argc, char *argv[]) {
|
||||
Log(Logs::Detail, Logs::Launcher, "Starting main loop...");
|
||||
|
||||
ProcLauncher *launch = ProcLauncher::get();
|
||||
|
||||
RunLoops = true;
|
||||
while(RunLoops) {
|
||||
auto loop_fn = [&](EQ::Timer* t) {
|
||||
//Advance the timer to our current point in time
|
||||
Timer::SetCurrentTime();
|
||||
|
||||
if (!RunLoops) {
|
||||
EQ::EventLoop::Get().Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Let the process manager look for dead children
|
||||
*/
|
||||
@@ -120,29 +126,31 @@ int main(int argc, char *argv[]) {
|
||||
*/
|
||||
zone = zones.begin();
|
||||
zend = zones.end();
|
||||
for(; zone != zend; ++zone) {
|
||||
if(!zone->second->Process())
|
||||
for (; zone != zend; ++zone) {
|
||||
if (!zone->second->Process())
|
||||
to_remove.insert(zone->first);
|
||||
}
|
||||
|
||||
/*
|
||||
* Kill off any zones which have stopped
|
||||
*/
|
||||
while(!to_remove.empty()) {
|
||||
while (!to_remove.empty()) {
|
||||
std::string rem = *to_remove.begin();
|
||||
to_remove.erase(rem);
|
||||
zone = zones.find(rem);
|
||||
if(zone == zones.end()) {
|
||||
if (zone == zones.end()) {
|
||||
//wtf...
|
||||
continue;
|
||||
}
|
||||
delete zone->second;
|
||||
zones.erase(rem);
|
||||
}
|
||||
};
|
||||
|
||||
EQ::EventLoop::Get().Process();
|
||||
Sleep(5);
|
||||
}
|
||||
EQ::Timer process_timer(loop_fn);
|
||||
process_timer.Start(32, true);
|
||||
|
||||
EQ::EventLoop::Get().Run();
|
||||
|
||||
//try to be semi-nice about this... without waiting too long
|
||||
zone = zones.begin();
|
||||
|
||||
Reference in New Issue
Block a user