Use setpriority() instead of nice() on UNIX-like systems.

The return value of nice() can not reliably indicate errors. The return value
of the setpriority() call is well-defined.
This commit is contained in:
Guus Sliepen 2010-11-20 14:31:11 +00:00
parent d91903ef3c
commit cac0a5c651

View file

@ -502,12 +502,12 @@ static bool drop_privs() {
} }
#ifdef HAVE_MINGW #ifdef HAVE_MINGW
# define setpriority(level) SetPriorityClass(GetCurrentProcess(), level) # define setpriority(level) SetPriorityClass(GetCurrentProcess(), (level))
#else #else
# define NORMAL_PRIORITY_CLASS 0 # define NORMAL_PRIORITY_CLASS 0
# define BELOW_NORMAL_PRIORITY_CLASS 10 # define BELOW_NORMAL_PRIORITY_CLASS 10
# define HIGH_PRIORITY_CLASS -10 # define HIGH_PRIORITY_CLASS -10
# define setpriority(level) nice(level) # define setpriority(level) (setpriority(PRIO_PROCESS, 0, (level)))
#endif #endif
int main(int argc, char **argv) { int main(int argc, char **argv) {