Added ability to use default looping behavior of libuv, in use in zone now

This commit is contained in:
KimLS 2020-01-03 19:12:55 -08:00
parent 958a6d939e
commit 6243a31644
2 changed files with 6 additions and 22 deletions

View File

@ -21,6 +21,10 @@ namespace EQ
uv_run(&m_loop, UV_RUN_NOWAIT);
}
void Run() {
uv_run(&m_loop, UV_RUN_DEFAULT);
}
uv_loop_t* Handle() { return &m_loop; }
private:

View File

@ -548,29 +548,9 @@ int main(int argc, char** argv) {
};
EQ::Timer process_timer(loop_fn);
process_timer.Start(1000, true);
process_timer.Start(32, true);
while (RunLoops) {
bool previous_loaded = is_zone_loaded && numclients > 0;
EQ::EventLoop::Get().Process();
bool current_loaded = is_zone_loaded && numclients > 0;
if (previous_loaded && !current_loaded) {
process_timer.Stop();
process_timer.Start(1000, true);
}
else if (!previous_loaded && current_loaded) {
process_timer.Stop();
process_timer.Start(32, true);
}
if (current_loaded) {
Sleep(1);
}
else {
Sleep(10);
}
}
EQ::EventLoop::Get().Run();
entity_list.Clear();
entity_list.RemoveAllEncounters(); // gotta do it manually or rewrite lots of shit :P