From 8edd0456a3a85341ad429a887691487beed3262c Mon Sep 17 00:00:00 2001 From: MadCamel Date: Fri, 28 Feb 2014 09:09:07 -0500 Subject: Lower process priority when saving login/char databases In the event of CPU contention this will make forked database writes take a back-seat to the actual running server. --- src/login/login.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/login') diff --git a/src/login/login.cpp b/src/login/login.cpp index ea58669..b21b028 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -5,6 +5,8 @@ #include #include +#include + #include #include #include @@ -652,6 +654,10 @@ void check_auth_sync(TimerData *, tick_t) if ((pid = fork()) > 0) return; + // If we're a child, run as a lower priority process + if (pid == 0) + setpriority(PRIO_PROCESS, getpid(), 10); + mmo_auth_sync(); // If we're a child we should suicide now. -- cgit v1.2.3-60-g2f50