mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-05 19:32:25 +00:00
Added ability to use default looping behavior of libuv, in use in zone now
This commit is contained in:
parent
958a6d939e
commit
6243a31644
@ -21,6 +21,10 @@ namespace EQ
|
|||||||
uv_run(&m_loop, UV_RUN_NOWAIT);
|
uv_run(&m_loop, UV_RUN_NOWAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Run() {
|
||||||
|
uv_run(&m_loop, UV_RUN_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
uv_loop_t* Handle() { return &m_loop; }
|
uv_loop_t* Handle() { return &m_loop; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -548,29 +548,9 @@ int main(int argc, char** argv) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
EQ::Timer process_timer(loop_fn);
|
EQ::Timer process_timer(loop_fn);
|
||||||
process_timer.Start(1000, true);
|
process_timer.Start(32, true);
|
||||||
|
|
||||||
while (RunLoops) {
|
EQ::EventLoop::Get().Run();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
entity_list.Clear();
|
entity_list.Clear();
|
||||||
entity_list.RemoveAllEncounters(); // gotta do it manually or rewrite lots of shit :P
|
entity_list.RemoveAllEncounters(); // gotta do it manually or rewrite lots of shit :P
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user