diff options
author | MadCamel <madcamel@gmail.com> | 2014-02-28 09:09:07 -0500 |
---|---|---|
committer | MadCamel <madcamel@gmail.com> | 2014-02-28 09:09:07 -0500 |
commit | 8edd0456a3a85341ad429a887691487beed3262c (patch) | |
tree | 8bac03fde1e67dca823e386c0549c33614efbcf4 /src/login | |
parent | 7fae5e75b0d7d6c2dc17d8515f6e869d09528b17 (diff) | |
download | tmwa-8edd0456a3a85341ad429a887691487beed3262c.tar.gz tmwa-8edd0456a3a85341ad429a887691487beed3262c.tar.bz2 tmwa-8edd0456a3a85341ad429a887691487beed3262c.tar.xz tmwa-8edd0456a3a85341ad429a887691487beed3262c.zip |
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.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/login.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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 <netdb.h> #include <unistd.h> +#include <sys/resource.h> + #include <cstdlib> #include <cstring> #include <ctime> @@ -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. |