From 374ea610f40a488c6004ec3a729d56327b6bf1c2 Mon Sep 17 00:00:00 2001 From: dockes Date: Mon, 7 Dec 2009 18:47:52 +0000 Subject: [PATCH] use setpriority() to be a nice indexer --- src/index/recollindex.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index 5441e364..7a91b5d0 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -23,7 +23,10 @@ static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.38 2008-10-14 06:07:42 dockes #include #include +#include #include +#include +#include #include #include @@ -264,6 +267,10 @@ int main(int argc, const char **argv) exit(1); } bool rezero(op_flags & OPT_z); + + if (setpriority(PRIO_PGRP, 0, 20) != 0) { + LOGINFO(("recollindex: can't setpriority(), errno %d\n", errno)); + } if (op_flags & (OPT_i|OPT_e)) { list filenames; @@ -312,6 +319,11 @@ int main(int argc, const char **argv) LOGDEB(("recollindex: daemonizing\n")); daemon(0,0); } + // Not too sure if I have to redo the nice thing after daemon(), + // can't hurt anyway (easier than testing on all platforms...) + if (setpriority(PRIO_PGRP, 0, 20) != 0) { + LOGINFO(("recollindex: can't setpriority(), errno %d\n", errno)); + } if (sleepsecs > 0) { LOGDEB(("recollindex: sleeping %d\n", sleepsecs)); sleep(sleepsecs);